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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tLoop using while condition need a list output

 Hi All,

 

I will try to word this as best as possible, but basically I have a tloop using the while condition stating "StartAt" < "Total". StartAt will begin = 0 and Total = 7453.  At the beginning of the loop I am running a tRest using the StartAt as a parameter in a rest call and getting dates in return (50 at a time) putting them into a tMap and then increment StartAt = StartAt + 50.  As you can see this will loop through many times and everything looks alright when I place a tLogRow in the loop, however, I am looking to use this list of dates outside of this loop.  I need to then get the 7453 dates and pull out only the unique rows hopefully cutting this number to around 300.  Once I have this down to 300 I then need to do another loop using this list 1 at a time.  I hope I've made myself clear here, and I really hope someone will be able to help me out with this as I've been stuck on it for quite awhile.  For now, below/attached is where I'm at and any advice would be greatly appreciated!

 

Thanks!

 

tLoop --iterate--> tRest --Main--> tExtractJSON --Main--> tMap --Main--> tJava

 

StartAt = 0

MaxResults = 50

Total = 7453

 

inside tLoop

condition --> ((Integer)globalMap.get("row19.StartAt") <= (Integer)globalMap.get("row19.Total"))

 

 

inside tJava

-->globalMap.put("row19.StartAt", (Integer)globalMap.get("row19.StartAt") + (Integer)globalMap.get("row19.MaxResults"));

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I *think* I understand your issue here. Have you tried using a tHashOutput with the "append" switch set to true? You would add this to the end of the initial tLoop flow. Then in another subjob afterwards, use a tHashInput to read the full dataset from the tHashOutput. You could then do any filtering, etc, on that complete set.

 

You can see the documentation for the tHash components here (https://help.talend.com/reader/KxVIhxtXBBFymmkkWJ~O4Q/ZyJapHDibvg4pI_FFSSyWA) and here (https://help.talend.com/reader/KxVIhxtXBBFymmkkWJ~O4Q/orW6wqQ6z3Yd2iygtoCMeg?section=technical-thash...)

 

 

View solution in original post

4 Replies
Anonymous
Not applicable
Author

I *think* I understand your issue here. Have you tried using a tHashOutput with the "append" switch set to true? You would add this to the end of the initial tLoop flow. Then in another subjob afterwards, use a tHashInput to read the full dataset from the tHashOutput. You could then do any filtering, etc, on that complete set.

 

You can see the documentation for the tHash components here (https://help.talend.com/reader/KxVIhxtXBBFymmkkWJ~O4Q/ZyJapHDibvg4pI_FFSSyWA) and here (https://help.talend.com/reader/KxVIhxtXBBFymmkkWJ~O4Q/orW6wqQ6z3Yd2iygtoCMeg?section=technical-thash...)

 

 

Anonymous
Not applicable
Author

Hi @rhall , no I have not tried this and will give it a go right now, thanks for the quick response!!  I do have one more question though in regards to the tHashInput; I will eventually have 2 of these "large" lists, and need to have a nested loop run on both (~300 on the outter tHashOutput and ~150 on the inner tHashOutput).  I wanted to just verify this is possible before I try to figure out how to do it.  Thanks again!

Anonymous
Not applicable
Author

I'm not sure I entirely understand, but I sense you are asking about using multiple tHashOutput and tHashInput components. This is entirely possible and I use this technique all the time

Anonymous
Not applicable
Author

This worked perfectly thanks so much!