Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
HowieS
Contributor
Contributor

Using tFileInputMSPosition with RegEx filter or multiple headers

Hi Group:

I have a positional text file with lots of specific schemas. Each line is identified by 2 characters at position 33,34. The schemas are based on a range of values.

(i.e value 01-09 have a pattern of 8,2,20,2,10,1,1...etc

value 10-19 have a pattern of 8,4,20,2,2,4,40,

...etc

value 20-29 have a pattern of

8,4,20,2,6,28,1,1...etc

and so on).

Rather than repeating the "Header Value" 9 times for each single entry in the range, can I use something to identify the range values ike ( "01" or "02" or "03"..etc.) for a specific schema.

Thanks group.

Labels (3)
2 Replies
gjeremy1617088143

Hi, you can use a tFileInputRaw to read the file line by line and in a tmap for example you can redirect the output in different flow with condition in the filter expression like : (your input).contains("8,2,20,2,10,1,1...") then you write all your output in positional file with tFileOutputRaw, then you read the new files created with the schema you want for each of them. Send me love and kudos

HowieS
Contributor
Contributor
Author

Thanks! I did something similar using tFileInputPositional and tFileOutputPositional. Pulling in each row to tMap, then analyzing the key value string in StringHandling.SUBSTR(row1.row,33,2)  for conditional statement, and including my own identity key as the last column. Now I can use my own key value to filter for tFileInputMSPositional and reduce the amount of schema definitions (goes from 50+ down to 6). Wish I didn't have to read and write as an extra step, but oh well. Thanks again!