Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
SilviyaK
Contributor III
Contributor III

Dynamically Load Items

Hi all, 

I have the following script:

LIB CONNECT TO 'REST_sample_connection';

Let j=0;

for j = 0 to 10

Let vID = peek('ID', $(j), 'Data_Details');

RestConnectorMasterTable:
SQL SELECT (I removed the details here as they are not important)

.
.
.

FROM JSON (wrap on) "root" PK "__KEY_root"
WITH CONNECTION (
URL "https://api-sample.com/sample/sample",
QUERY "filter" "detail.id eq '$(vID)'",
HTTPHEADER "Authorization" "Bearer $(vToken)"
);

next j;

DROP TABLE RestConnectorMasterTable;

Data_Details is a table I load before that, which has a field with 10 IDs. What I want to do in the script above is to perform the above load with a filter on each of these 10 IDs. 

Any ideas why my script doesn't work? 

Labels (1)
3 Replies
rachel_delany
Creator II
Creator II

What is the error that you get when you try to load the script?

SilviyaK
Contributor III
Contributor III
Author

Hi Rachel,

No error, but it just doesn't load anything from this table where I apply the logic above. 

If I put a specific ID instead of the variable in the filter, it works with no issue. 

Any ideas what might be done wrongly in the above logic? 

rachel_delany
Creator II
Creator II

The issue might be that the filter needs a number rather than a string, try this instead:

QUERY "filter" "detail.id eq $(vID)",