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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

extracting a variable from redshift and using it in a loop

I have a query that will extract exactly one integer, as such:
select max(int_column) from table
I want to take that integer, j, and put it into a tLoop, with
while
declaration: int i = 0
condition: i <= j
iteration: i++
I'm having trouble finding a way to turn my query into a variable.  Thank you for any help.
Labels (2)
1 Reply
Anonymous
Not applicable
Author

I got something to work, though I don't think it's the most efficient.
put the query in tRedshiftInput
row1(Main) to tFlowToIterate
iterate to tJava, with code: globalMap.put("max", (int)row1.int_column);
tLoop with
while
declaration: int i = 0
condition: i <= (int) globalMap.get("max")
iteration: i++