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: 
Serphentelm
Contributor III
Contributor III

Loop a job using element of an array as indexes of the cycle

Hi, new day new problem.

I want to create a process that loop a job that I already developed as follow:

0695b00000hukhZAAQ.png 

0695b00000hukhjAAA.png 

Here's my problem: my table out_004_001_out_ici_versamenti_all has a column year, and I want to excute this job n times as many years I have.

In Java I've already done something similar: I read the minimum and the maximum year, then i write a for that cycle between them and I modify the query to match the current year I'm iterating.

I could also read a distinct of the year, save them into an array, and use said array to loop.

Is there a way to save my data into an array ad use this array's length in the loop component?

 

For example, my minimum year is 2012 and maximum year is 2022, so i want to Loop the job 11 times, and every time setting the where clause in the job to match the current year

Labels (2)
1 Solution

Accepted Solutions
Serphentelm
Contributor III
Contributor III
Author

I solved the problem using a tFlowIterate: I read the distinct of the year with the tdbInput compenent, I've linked it to the tFlowIterate component and eventually to the tRunJob.

On the TrunJob component, I've used a context variables in which I save the year read in the distinct query. I've called this variable in the child parent to loop whithin every year saved.

 

View solution in original post

2 Replies
Serphentelm
Contributor III
Contributor III
Author

I solved the problem using a tFlowIterate: I read the distinct of the year with the tdbInput compenent, I've linked it to the tFlowIterate component and eventually to the tRunJob.

On the TrunJob component, I've used a context variables in which I save the year read in the distinct query. I've called this variable in the child parent to loop whithin every year saved.

 

Anonymous
Not applicable

Hello,

Thanks for letting us know you've resolved your issue by yourself and sharing your solution with us on Community.

Best regards

Sabrina