Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

JSON Rest - Pagination Limits and Date Issues

Hi everyone!


I have an aplication which connects with an API through JSON Rest. In this API, every call can extracts an maximum of 1.500 registers through 15 pages, each one with 100 registers. The parameter which sets the beggining of the load is the log date ('YYYY-MM-DD hh:mm:ss'), limited between initial date and final date (here, the ReloadTime()).

Day by day it works fine, using the below load script:

SET lastload=0;

SET currentload=1;

SET vPage=1;

SET vInitialDate=(here We have the maximum date generated in the last load).

LET vFinalDate = ReloadTime();

DO WHILE $(lastload) <> $(currentload)

IF lastload = currentload THEN

EXIT DO

ENDIF

LET lastload = currentload;

Table:

SQL SELECT

(Script SQL)

WITH CONNECTION (  

      QUERY "page" "$(vPage)",

      QUERY "log_created_at" "$(vInitialDate|vFinalDate)"

  ); 

LET currentload = NoOfRows('Table');

LET vPage = vPage + 1;

LOOP;

Every load is programmed through QMC to starts every 20 minutes. The problem here is when the number of registers reachs 1.500. In the script above, the load stops when this happens. In this situation, I have to wait for the next programmed load to extract the others records and so on.

Is there a way to insert the maximum log date in the each loop's load, possibiliting restarting of the routine considering each new maximum date, stopping the load when reaching zero number of the rows?

Thanks in advance!

0 Replies