Reading a large fixed length file with 100+ fields and would like to insert decimal point during the read of the file.
example of what a row looks like below:
01A0000100001AB
if the type for each field was all strings it will be converted to:
Hello wkerr,
from your example, it seems that it is not possible to read the string “00001” directly into the decimal 0.0001. As you rightly indicated, you would have to take advantage of the Reformat component to achieve the desired format. I would suggest taking this path:
Read the input fields (field3 and field4) as strings (“00001”).
Add the Reformat component into your graph and assign the output metadata as per your example ().
Use the following transformation in the reformat transform function:
Note: the charAt() function grabs the first character (index position 0 in the input string) and concatenates it with the dot character and the substring of the input string (from the index position 1 onwards).
If this does not meet your needs (for example due to the higher complexity of the actual input file), feel free to get back to us with more details.
Regards,