Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Read Fixed width Flat file using TOS

Hi All,

I am trying to read a Fixed Width flat file using tFileInputPositional. However, there are a couple of things that needs to be ensured when the data is red from the source.
i. The trailing spaces for all fields needs to be trimmed.
ii. If the data present in the fields of the file consist only of '*' then we need to read the field data as ''. Whereas if the data consists of characters along with '*' then the data should be read as is. (eg:'****' or '***********' gets read as '' . But 'abc**erf*' gets read as 'abc**erf*')
Please suggest if there is any easier way  of getting this done rather than dealing with each source field individually in a tMap.

Thanks

Labels (2)
2 Replies
Anonymous
Not applicable
Author

Hi
For 1, there is a 'trim all column' box option in the advanced setting panel of tFileInputPositional component, this box is checked by default. 
For 2, I think you need to hard code to check and transform the data after reading it from the source file.
Anonymous
Not applicable
Author

Hi,

As suggested I tried using the below expression for point 2:

StringHandling.LEN(StringHandling.EREPLACE(out1.row1,"*","")) > 0 ? Fout1.row1 : "" 

But this gives an error like java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 2.

Please suggest whether its required to put escape characters with '*' like '\\*' to make it work.