Discussion:
Reading Input text file value based on their position in string
(too old to reply)
Muthiah Nataraj
2018-07-30 18:48:53 UTC
Permalink
Hello,
I need to read a plain text file and separate the values based on the character position.
For e.x.
Input file: Entry
500203chicago IL

I need to read the value like,
500 - Department Number (position 1-3)
203 - Division Code (position 4-6)
chicago - City (position 7-13)
IL - State(position 15-17)

Could you please help with how to read the input file and what parser need to be used.

Thank You.
John Dell'Oso
2018-07-31 00:08:18 UTC
Permalink
Post by Muthiah Nataraj
Hello,
I need to read a plain text file and separate the values based on the character position.
For e.x.
Input file: Entry
500203chicago IL
I need to read the value like,
500 - Department Number (position 1-3)
203 - Division Code (position 4-6)
chicago - City (position 7-13)
IL - State(position 15-17)
Could you please help with how to read the input file and what parser need to be used.
Thank You.
Hello,

I feel that you really need to look through the Getting Started section in the Knowledge Centre and do the tutorial.

Anyway, to get you started:

1) You need to set up a File Connector in the Feed section and point it to your file.

2) Then select the fixed length parser for this connector and specify your field names, their starting positions and lengths - so for your case, something like (field names can be changed to something of your choosing):

dept,1,3
div,4,3
city,7,7
state,15,3

The field names will then be available to the work entry in your assembly line after adding them to the input map.

But as I have already said, you really need to do the tutorial and gain a basic understanding of SDI so that terms like Feed section, assembly line, work entry, input map etc. become second nature to you.

Regards,
JD
Muthiah Nataraj
2018-08-01 14:28:06 UTC
Permalink
Post by Muthiah Nataraj
Post by Muthiah Nataraj
Hello,
I need to read a plain text file and separate the values based on the character position.
For e.x.
Input file: Entry
500203chicago IL
I need to read the value like,
500 - Department Number (position 1-3)
203 - Division Code (position 4-6)
chicago - City (position 7-13)
IL - State(position 15-17)
Could you please help with how to read the input file and what parser need to be used.
Thank You.
Hello,
I feel that you really need to look through the Getting Started section in the Knowledge Centre and do the tutorial.
1) You need to set up a File Connector in the Feed section and point it to your file.
dept,1,3
div,4,3
city,7,7
state,15,3
The field names will then be available to the work entry in your assembly line after adding them to the input map.
But as I have already said, you really need to do the tutorial and gain a basic understanding of SDI so that terms like Feed section, assembly line, work entry, input map etc. become second nature to you.
Regards,
JD
Thank You JD. IT helped.

Loading...