Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
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++