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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to execute on every 100 rows of data?

Hey,
I am pretty sure talend should be able to do this task relatively easily, but I am not sure the best way to go about it.
I have 100,000 rows of data, but an API I am calling can only take 100 rows of data per API call.
I would like to execute an API call on 100 rows each time until I have looped through the full 100,000 row data set.
Any advice/recommended components on going about this is much appreciated.
Thanks,
Brian
Labels (2)
28 Replies
Anonymous
Not applicable
Author

In the tMap use this expression as filter
(Numeric.sequence("index",1,1) % 100) == 0

If you need to filter also on other places in your job (even child or parent jobs) take care you give the sequence different names because they are static.
Anonymous
Not applicable
Author

Ahh i see what youre saying, but Im not sure this solves my problem. I can only get it to process every 100th record alone, not all in between?
I'm trying to create an XML document to be processed when its 100 element large, once it hits that send the data off to the external service then create the next document with another 100 rows in until there arent anymore rows to process. Is there a way to achieve this?
Anonymous
Not applicable
Author

I have an idea, please check if you can implement this.
- Create a sequence (rowID) for incoming rows using sequence generator
- Create a filter to filter records having rowID > 100 and write it to file
- Create subjob and process the file like first step above
- Once the file is processed, move the file and push to archive folder
- and repeat the process again till you have a file
Thanks
Vaibhav
Anonymous
Not applicable
Author

@Vaibhav,  thanks for the response. I was really trying / hoping to stay away from saving files (as i know there is a split functionality in tAdvancedFileOutputXML), do you know if there are any other ways to keep it all in short term memory without saving to disk?
Anonymous
Not applicable
Author

Then, Why not to use buffer/hash components?
Anonymous
Not applicable
Author

Okay, i could try. Ive only used these (tBufferOutput) before for passing data up to parent jobs though, how would i use this to pass data at the right time within the same job?
Anonymous
Not applicable
Author

Anonymous
Not applicable
Author

I have had a look here, I have tried something similar but couldnt get it to work correctly. I have already pulled all of the data out of the database, I want to loop through each of those records and on record 100 do something. Id rather not make a call to the DB every time I loop. Im really struggling to understand how to do this in Talend without it being really complicated 😞 
Anonymous
Not applicable
Author

Hi 
Take a look at this topic, hope it could give you a hint.
Best regards
Shong
Anonymous
Not applicable
Author

Before starting to create a small poc for you, can you pl show your existing job design?