Script to Pull Numeric Data from a String

Description

How do you pull all the numeric data from a field?


 Follow these steps:

  1. Set up a scripting field, an input field and an output field.
  2. Modify the example below using the names of the fields on your label.
  3. Copy the modified script into the scripting field data source window.
Copy
Sample Script
<pre class="syntaxhighlighter-pre" xml:space="preserve">var result = "";
var input = String(label.fields.field.(@name == 'input').@data);

// for loop
for (i=0; i < input.length; i++)
// if statement using "or" logic - ||
   {if (input.charAt(i) < '0' || input.charAt(i) >'9')
      {
      result = result;
      }
      else
      {
      result = result + input.charAt(i);
      }
   }

label.fields.field.(@name == 'output').@data = result;
</pre>