New column declared as integer; value stored as string
Moderators: chulett, rschirm, roy
New column declared as integer; value stored as string
We have an integer value as input in one of the columns. We declare a new column as an integer in the Transformer stage and perform some basic if-then-else logic on the incoming integer column and store an integer in the newly declared interger column of the Transformer stage. The problem is this integer is converted into a string and stored as a string (within double quotes as we have give the Field default option Quote=Double). We are not sure why this is happening and any help would be appreciated.
Thanks.
Thanks.
In your "similar problem" case, were the integers truly stored in an integer format (binary instead of character) in the sequential files, or were they simply a string of character digits? For example, regard the following record from a text (i.e. all character) csv file:
There are five 2-byte columns of data. Would you say that these are integers or that they are strings? I can treat them as either.
If you're calling your converted integers strings just because they have quotes around the values, remove the quotes option from the Field Defaults category on the Format tab in your sequential file stage. If you still want quotes around your strings, add the option at the column level.
Regards,
Code: Select all
92,91,50,25,72
If you're calling your converted integers strings just because they have quotes around the values, remove the quotes option from the Field Defaults category on the Format tab in your sequential file stage. If you still want quotes around your strings, add the option at the column level.
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
Removing the quotes option from the Field Defaults category on the Format tab in the sequential file stage fixed the problem.
James,
I believe the integers were stored as integer but were enclosed in strings. How do you check the hex code of the file? I believe looking at the hex code gives you the exact picture, right?
James,
I believe the integers were stored as integer but were enclosed in strings. How do you check the hex code of the file? I believe looking at the hex code gives you the exact picture, right?
If you can read the integers when viewing the file with more, less or cat, then the values are stored as character strings. If they were stored as actual integer format fields, you would see garbage and/or your records would appear to be corrupted somehow.
more, less and cat have no concept of data layouts other than standard line terminators and therefore have no ability to automatically convert non-character data (i.e. Integers in integer format) to character.
Regards,
more, less and cat have no concept of data layouts other than standard line terminators and therefore have no ability to automatically convert non-character data (i.e. Integers in integer format) to character.
They were stored as character representations of integers and enclosed in quotes. You could not have visually read them if they were anything other than character strings.I believe the integers were stored as integer but were enclosed in strings
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.