1.3.10.12 Convert String to Number
The Convert String to Number transformer takes values in a String or String Array attribute, recognizes them using a reference list of number formats, and attempts to convert them to a Number or Number Array type respectively.
Use Convert String to Number when you have numeric values held in a String or String Array attribute and want to perform number-specific processing on them - for example to run them through a Number Profiler.
To find numeric values in a String attribute, run the Data Types Profiler. To isolate records that do not have the expected data type in a given attribute, run a Data Type Check.
Note:
The Convert String to Number processor itself can do this in isolation, as it will "fail to convert"; that is, convert as null, any values that are not recognized as numbers using its reference list.
In order to convert a String or String Array attributes into the Number format, the processor needs to recognize numeric values correctly. This is achieved using a reference list with a standard set of numeric formats. A default standard Number Formats list is provided for this purpose.
The following table describes the configuration options:
Configuration | Description |
---|---|
Inputs |
Specify one or more String or String Array attributes for conversion to a Number or Number Array type. If multiple attributes are submitted for conversion and one fails the entire record is marked as having failed, although the valid attributes will be correctly converted. |
Options |
Specify the following options:
|
Outputs |
Describes any data attribute or flag attribute outputs. |
Data Attributes |
The following data attributes are output:
|
Flags |
The following flags are output:
|
The following table describes the statistics produced by the profiler:
Statistic | Description |
---|---|
Success |
The number of records where the String to Number conversion was successful. |
Failure |
The number of records where the String to Number conversion was unsuccessful. |
Click on the Additional Information button to show the above statistics as percentages.
Output Filters
The following output filters are available:
-
Records where conversion was successful
-
Records where conversion was unsuccessful
Example
The Employees table has an Extension attribute that should hold a numeric extension number, but which is stored as a String, that is, not as a controlled Number attribute.
Using the standard *Number Formats reference list to recognize numeric values, these are the results of the String to Number conversion:
Success | Failure |
---|---|
7 |
2 |
A drill down into a failure.
Extension | Extension.StringToNumber |
---|---|
x188 |
|
xtn 204 |