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: 
covenant_bi
Creator
Creator

Export calculated value of a variable from a load script to a text file

We have a need to export the value of a variable to a text file that can be read by a downstream program.  It is a very simple variable, it just sums a field, but we can't get the txt file to get the right output

NPCondition is field that gets created via a resident load and we are looking to sum the values of it and send that sum to a txt file.  For testing purposes, when I comment out all lines except the first, the variable calculates correctly in the Edit/dev side of Sense when used with $ sign expansion.  When we turn on the rest of the script, though, the output is either the text (the actual phrase sum(NPCondition) or nothing.  Any thoughts?

LET vNPConditionSum ='=sum(NPCondition)';
LET vNPConditionFlag = Peek('$(vNPConditionSum)');
CheckTable:
Load '$(vNPConditionFlag)' as NPConditionFlag
AutoGenerate 1;
Store NPConditionFlag from CheckTable into 'lib://Data/test.txt' (txt);

Labels (2)
0 Replies