Page 1 of 1
Identifying alphabets in a numeric field
Posted: Fri Mar 02, 2007 3:37 pm
by Lalitha
I am reading a sequential file with varchars(all fields as varchars inculding numbers) and trying to insert them into a table.The job abended with an "Invalid Number" error.One of the numeric fields contains alphabets or some wierd characters.How can I check in the transformer stage (or any other stage if I have to use one) if the incoming value is a numeric value.
Posted: Fri Mar 02, 2007 3:46 pm
by ray.wurlod
Welcome aboard. :D
There is an IsValid() function that allows you to check, in a Transformer stage, whether an input string is valid as some other data type.
Posted: Fri Mar 02, 2007 3:46 pm
by DSguru2B
Welcome Aboard,
There is a function AlNum() in the px transformer that performs Alpha-numeric checks. You can probably use that function.
Posted: Fri Mar 02, 2007 3:47 pm
by DSguru2B
On second thought, use IsValid()

Posted: Fri Mar 02, 2007 4:01 pm
by Lalitha
I tried using the Alnum function.Since it checks if the argument contains alphanumeric values, even a value of '1' is getting rejected. And when Nulls are encounted,I am getting the following error:
APT_CombinedOperatorController,1: Requirements Failure: Null string argument.
Requirements Failure: Null string argument.
I also tried using the Isvalid function,but got this error for Nulls:
APT_CombinedOperatorController,1: Expected identifier; got: <eof>
This is the error for a value of '1':
APT_CombinedOperatorController,2: Expected identifier; got: "1".
Posted: Fri Mar 02, 2007 4:44 pm
by ray.wurlod
Transformer functions are intolerant of nulls. You must handle them separately. NULL is valid for any data type (provided the receiving field is nullable). Therefore you require something like
Code: Select all
If IsNull(InLink.TheColumn) Then 1 Else IsValid("Integer", InLink.TheColumn)