Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I run the following code:
Apps:
LOAD * INLINE [
AppID
dfg9e1-cd7d-4f49-b978-80
fdgd9-9849-40d9-bbdb-a3
afc096d4-62be-4cb8-9b8f-2f
dfgdfg2ce2-e833-419b-8c0a-a9
];
LIB CONNECT TO 'ADM:REST_APPS';
FOR i=0 to NoOfRows('Apps')-1;
LET AppID=Peek('AppID',$(i));
Lineage:
LOAD *,'$(AppID)' as AppID
;
SQL SELECT "discriminator"
FROM JSON (wrap on) "root"
WITH CONNECTION (
URL "https://$(vu_tenant_fqdn)/api/v1/apps/$(AppID)/data/Lineage"
);
Trace App Lineage[$(i)]: $(AppID);
NEXT i;
When I run this code without the SQL (without the red portion) it works perfectly and gets the right appID.
When I run the code with all the SQL call it only runs it for the 1st AppID (4 times in this case)
I'm wondering if it has something to do with async or something?
I have even tried using the sleep statement, but with no change though.
Just wondering if anybody has encountered the same issue and has a work around.
Thank you
I changed this line in the code and seems to be working, if anyone else encounters the issue.
LET AppID=Peek('AppID',$(i),'Apps');
I added the tablename, even though that was the whole script and there was no other data in the app.
I changed this line in the code and seems to be working, if anyone else encounters the issue.
LET AppID=Peek('AppID',$(i),'Apps');
I added the tablename, even though that was the whole script and there was no other data in the app.
Hi @ruanh_ad,
Your problem is probably on your Peek function. Add the name of the table and you should be good.
LET AppID=Peek('AppID',$(i),'Apps');
My guess is the Peek function is getting the AppID field from the Lineage table instead of Apps table.
I personally prefer using For Each. Following my version of the code:
TempApps: LOAD * INLINE [ AppIDLoop 07cec6fe-8e05-4c2a-a56c-1e5dd466cd64 36c424a7-24c2-4a68-8305-459fb6b4ee16 65ea54a6-bd81-4b28-8a83-7cdb7dd57c81 ]; For Each vAppID In FieldValueList('AppIDLoop') LIB CONNECT TO 'Get Lineage'; Lineage: LOAD discriminator, '$(vAppID)' AS AppID ; SQL SELECT "discriminator" FROM JSON (wrap on) "root" WITH CONNECTION ( URL "https://mytennant.qlikcloud.com/api/v1/apps/$(vAppID)/data/lineage" ); DISCONNECT; Trace App Lineage Loaded: $(vAppID); NEXT vAppID; DROP TABLE TempApps;
Make sure your REST Connection have the check Allow With Connection enabled.
Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com