Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
simona_123
Contributor
Contributor

For each ... next

Hi, I'm new here and in Qliksense. 

I have very long script line

For each variable  in 'Value1', 'Value2', 'Value3' ..... 'Value n+50'

Next

If all values are in one line, everything is ok. But when I try to split them to few lines and make more readable it's come Syntax error. I tried to put all values in the parentheses (), but still doesn't work. 

Maybe somebody know how to solve this error, thank you 🙂 

Labels (1)
2 Replies
E_Røse
Creator II
Creator II

Nor exactly what you asked, but you could add all the variable- values to an inline table, and use the peek-function to loop through the values. Something like the following:

 

tmp:
load * inline [
values
value1
value2
...
];

For i=0 to NoOfRows('tmp')
    let vVal=peek('values',i, 'tmp')
    /*  your code here */

nexi i;

 

Please mark my answer as a solution, if it resolved your issue.

MarcoWedel

a similar solution using FieldValueList instead:

https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptC...

tabTemp:
LOAD * Inline [
variable
Value1,
Value2,
Value3,
Value4,
Value5,
Value6,
Value7,
Value8,
Value9,
Value10
];

FOR Each variable in FieldValueList('variable')
	...
NEXT

DROP Table tabTemp;