Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
Can you please help me to understand how to Load ID’s into variable from one table and pass them to other table one at a time using for loop
example-
table 1
iD, State
1,AAA
2,BBB
Table2:
iD,testID
1,1.1
1,1.2
2,2.1
2,2.2
where iD =( here I want to use variable to pass values of id from table 1 - one at at time using for loop)
Thanks in advance
something like this
table1:
load * inline
[
iD, State
1,AAA
2,BBB
];
for each i in FieldValueList('iD')
Table2:
let vvar=i;
load
'$(vvar)' as iD
AutoGenerate 1;
next i;
Try this:-
For i = 1 to NoOfRows('Table1')
Let vField = Peek('ID',i-1,'Table1');
//////////// Check These Variable Using Trace ////////////////
Table2:
Load * From Source where ID = '$(vField)';
Next;
/////////////// Depends on you if you want to concatenate or not.
@Qlikuser225 you have received two different suggestions to solve this. Please accept them if they solve your problem.
If thay are not the solution you need. Can you be more specific on why you need the loop and what will you do with the loop? Depending on your goal the two different suggestions can have different strengths, and maybe you are actually better of with a solution that is not using a loop.