Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

pauldamen
Contributor II

Loop to total rows

All,

I have a table which I retrieve in JSON format. This works with a skip and take function, so in a loop I change the skip to be able to loop through the table.

My problem is the To part of the loop. Because the take has a 5000 record limit if I use a function like NoOfRows('Table') it stops after the first loop because it sees the 5000. What I can use to let the loop run to 22.000 (which is now the number of records in the table)?

Regards, Paul

5 Replies
pradosh_thakur
Valued Contributor III

Re: Loop to total rows

Not sure if this gonna help but can you use rowno() and get its maximum value stored in a variable or use it directly?

pauldamen
Contributor II

Re: Loop to total rows

What would I need to do to try this suggestion?

Re: Loop to total rows

It sounds that it might be solvable with another loop which sliced your input-table. There you could add a counter maybe with something like:

ceil(rowno() / 5000) as LoopCounter

and then you could loop through this field like:

for i = 1 to fieldvaluecount(LoopCounter)

     FinalTable:

     load * from Table where LoopCounter = $(i);

     ... your other stuff ...

next

- Marcus

pauldamen
Contributor II

Re: Loop to total rows

Problem is I need tot loop to load the whole table since the source only allows me to get 5000 records at once.

So in order to load all records I need a loop statement, but in order to make the loop statement I need all records. So that is what I am sort of stuck in now.

Re: Loop to total rows

Sounds like you need to look at pagination - here is the url of to the loading paged data manual section

https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/1.0/Create-REST-connec...

The actual details of what you precisely need to do will depend on the details of your data source.

Community Browser