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

Announcements
Mastering Change Data Capture: Read Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Output to text file produces unwanted " "

Hi,

I am writing text to a text file and I need it in a precise format so that it can be read in by another tool.  Here is my script:

Table:

LOAD * INLINE [

ID, FullName

ID1, FullName1

ID2, FullName2

];

Table2:

LOAD * INLINE [

NewField

];

for a = 0 to NoOfRows('Table')-1

  CONCATENATE (Table2) LOAD

    Replace(Replace(Add,'*',peek('ID',$(a),'Table')),'%',peek('FullName',$(a),'Table')) as NewField

  FROM AddTemplate.txt (txt, codepage is 1252, embedded labels, delimiter is '~', msq);

next

store Table2 into sampleOutput.txt(txt);

I need to store the values in Table in the somewhat complicated format outlined in the AddTemplate file.  I have replaced the * in the template with the ID in Table, and the % in the template with FullName in Table.  That's what that double replace line does.

If you run this script, you'll see I get the correct output if you go to the data model and Preview Table2.  However, if you go to the sampleOutput.txt you'll see that we got double quotations around one of the lines.  This probably has to do with '=' or ',' signs in that line of the template. 

I need those quotations to go away in the text file...  Does anyone have any ideas?

Thanks.

2 Replies
Not applicable
Author

The quotation marks appear in your output file because the field value contains a separator/delimiter..

Not applicable
Author

OK but a delimiter that whole line does not load.  If you try it with no delimiter do you see that as well?