Evaluates an input against the String datatype. If the input matches, the function outputs a String value. Input can be a literal, a column of values, or a function returning values. Values can be of any data type.
After you have converted your values to strings, if a sufficient percentage of inputs from a column are successfully converted to the other data type, the column may be retyped.
Tip: If the column is not automatically retyped as a result of this function, you can manually set the type to String in a subsequent recipe step.
Output: Returns the String data type value for
|str_input||Y||any||Literal, name of a column, or a function returning values to match|
Literal, column name, or function returning values that are to be evaluated for conversion to String values.
|Required?||Data Type||Example Values|
The following table contains values for city, state, and zip code for locations in the United States:
In the above table, you can see that some of the values are listed as four-digit zip codes, which are invalid. These values are likely to be interpreted as Integer values, which means that any leading zeroes are dropped. You can use the steps below to fix it.
Since you are working with integer values, you can use the following transformation to test the length of the values as if they were strings using the PARSESTRING function. If the values are only four characters long, then the value is merged with a leading
$col reference points to the column that has been selected to be edited. In this case, that column is
Zip. For more information, see Source Metadata References.
Depending on the number of rows in your dataset, the may not re-infer the data as Zip type. You can use the following transformation to change the data type for the column to Zip: