Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
I am trying to load data from the following API endpoint using the Qlik REST Connector:
API URL: https://disease.sh/v3/covid-19/countries/USA
Implementation Details:
My Script:
SET vCountry = 'USA'; // Default Country
LIB CONNECT TO 'CovidAPI';
CovidData:
SQL SELECT
"country",
"cases",
"recovered"
FROM JSON (wrap on) "root"
WITH CONNECTION (
URL "https://disease.sh/v3/covid-19/countries/$(vCountry)"
);
Issue:
When I select a different country (e.g., 'India' or 'UK') from the input variable and click the reload button, the table chart is not updating to reflect the selected country’s data. It still shows the previously loaded data.
Troubleshooting Done:
Checked if "WITH CONNECTION" is enabled in the REST Connector settings.
Verified that vCountry is updating correctly in the Variable Editor.
Manually running the script with a hardcoded country (e.g., SET vCountry = 'India';) works fine.
Questions:
Any insights or alternative approaches would be greatly appreciated!
Thanks in advance!
Hi @Eshwar1,
In summary, you cannot set a variable in your Load Script. This Load Script variable will always have its value reset during the load process - unless you do some fancy logic. Instead of doing that, create a variable in your dashboard:
1. Create your variable in your User Interface. Click on the Variable button showed in the picture below and then click on Create new button.
2. Now, use this new variable to setup the values from the User Interface. Every time you set it on the UI, it will be carried to your Load Script.
Regards,
Mark Costa
Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com
@Eshwar1 have you gone through this post: https://community.qlik.com/t5/App-Development/Chart-is-not-updated-automatically-if-variable-is-used...
Hi @Eshwar1,
In summary, you cannot set a variable in your Load Script. This Load Script variable will always have its value reset during the load process - unless you do some fancy logic. Instead of doing that, create a variable in your dashboard:
1. Create your variable in your User Interface. Click on the Variable button showed in the picture below and then click on Create new button.
2. Now, use this new variable to setup the values from the User Interface. Every time you set it on the UI, it will be carried to your Load Script.
Regards,
Mark Costa
Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com
Thank you Mark, its working now as expected.