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

How to do a loop on a column value

Hello,
I need to build an output table with a number of rows coming from a input column.
Here my input table
Category;Number
***************
Cat1;2
Cat2;3
I need to create in the output table 2 rows for the first, 3 for the next, etc..
I've created a job to create the output rows, and I've tried to read my input table with a tfileinputdelimited and iterate on a tfor component giving $tfileinputdelimited as the limit and a trunjob to execute the first job in each loop.
It doesn't work, but I think I'm wrong with my understanding of the tfor component.
Thanks to lead me on the right way....
Louis
Labels (2)
2 Replies
Anonymous
Not applicable
Author

Hi Louis
Can you upload a screenshot of your job? and what's the format do your expected output?
Best regards
shong
_AnonymousUser
Specialist III
Specialist III

Hi,
You can use this pattern :
(A) tFileInputDelimited_1 -> (B) tFlowToIterate_1 -> (C) tRowGenerator_1 -> (D) tIterateToFlow_1 -> (E) tLogRow_1
with
(B) : check "use the default (key, value) for global variables"
(C) :
- Schema :
Column | Type | Function | Params
--------------------------------------------
Category | String | ... | (String) globalMap.get("row1.Category")

and
- Number of Rows for RowGenerator = (Integer) globalMap.get("row1.Number")