Discussion board where members can learn more about Qlik Sense App Development and Usage.
In Java it is easy to drop this code inside a for loop and then get a nicely concatenated string.
a = new StringBuilder() .append(a) .append(b) .toString();
However I haven't been able to do the same in Qlik Sene. I am trying to achieve something like this:
Let vMyVar = 'some text ';
For i = 1 to 3
vMyVar += i + Peek('City', $(i), 'weatherdata');
Trace $(vMyvar );
Where $(vMyvar) must be in the end => some text 1 France 2 Madrid 3 Lund
I hope this is clear
Go to Solution.
This works give one small correction in the code:
let vMyVar = '';
vMyVar = '$(vMyVar)' & ' ' & Peek('City', $(i), 'weatherdata');
Note the single quotation around $(vMyVar).
I will still test it later with real data from the net and see what happens. I wished the Qlik syntax was more flexible like Java, JS or even action script, not sure into which category to put it
Thank you very much for your answer it was helpful and confirm something similar I found yesterday night.
I can think of two ways to achieve this right of the bat.
1. Use a variable in the loop:
vMyVar = $(vMyVar) & ' ' & Peek('City', $(i), 'weatherdata');
2. Use Concat() to get all text rows of one table into the same row. Perhaps you need to merge your city and number field first and then concat:
The Concat Function