Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello qlik professionals,
I have a for each loop that takes some parameters of numbers in some pre existing dimensions that loops through possible values for a REST API, that I alter their values each round with variables:
For vAnio = 2023 To Year(Today())
FOR vMes = 1 TO 9// Month(Today())
FOR EACH vProvinciaEstacion IN FieldValueList('PROVINCIA_ESTACION')
LET vURL = '"https://www.juntadeandalucia.es/agriculturaypesca/ifapa/riaws/datosmensuales/'
& Text(vProvinciaEstacion) &'/' & $(vAnio) &'/'& $(vMes)&'"';
RestConnectorMasterTable:
SQL
SELECT
"anyo",
"mes",
"numDias",
"tempMedia",
"tempMax",
"diaHorMinTempMax",
"tempMin",
"diaHorMinTempMin",
"humedadMedia",
"humedadMax",
"diahorMinHumMax",
"humedadMin",
"diahorMinHumMin",
"velViento",
"dirViento",
"velVientoMax",
"diahorMinVelMax",
"dirVientoVelMax",
"precipitacion",
"radiacion",
"bateria",
"fechaUtlMod"
FROM JSON (wrap on) "root"
WITH CONNECTION ( URL $(vURL));
NEXT vProvinciaEstacion
NEXT vMes
Next vAnio
But that´s not true, this API call exists, if you search it, it will return the array I´m looking for, and it actually adds a returned line in my table:
https://www.juntadeandalucia.es/agriculturaypesca/ifapa/riaws/datosmensuales/18/11/2023/1
Sometimes when I have it programmed so it runs every x days, doesn´t work well and I don´t get the info that day, whats the problem and how can I fix it?
All help is much appreciated,
Thank you!
Hi,
the above works for me, as in your case it might be because of Set & LET may be use he below code hope it helps you
For vAnio = 2023 To Year(Today())
For vMes = 1 To 9
set urlParam = $(vAnio)&'/'&$(vMes);
trace urlParam: $(urlParam);
/* use SET instead of LET*/
SET vURL = '"https://www.juntadeandalucia.es/agriculturaypesca/ifapa/riaws/datosmensuales/18/11/'& $(urlParam)&'"';
trace vURL: $(vURL);
LIB CONNECT TO 'REST_jsonplaceholder';
RestConnectorMasterTable:
SQL SELECT
"anyo",
"mes",
"numDias",
"tempMedia",
"tempMax",
"diaHorMinTempMax",
"tempMin",
"diaHorMinTempMin",
"humedadMedia",
"humedadMax",
"diahorMinHumMax",
"humedadMin",
"diahorMinHumMin",
"velViento",
"dirViento",
"velVientoMax",
"diahorMinVelMax",
"dirVientoVelMax",
"precipitacion",
"radiacion",
"bateria",
"fechaUtlMod"
FROM JSON (wrap on) "root"
WITH CONNECTION (URL $(vURL));
[root]:
LOAD [anyo],
[mes],
[numDias],
[tempMedia],
[tempMax],
[diaHorMinTempMax],
[tempMin],
[diaHorMinTempMin],
[humedadMedia],
[humedadMax],
[diahorMinHumMax],
[humedadMin],
[diahorMinHumMin],
[velViento],
[dirViento],
[velVientoMax],
[diahorMinVelMax],
[dirVientoVelMax],
[precipitacion],
[radiacion],
[bateria],
[fechaUtlMod]
RESIDENT RestConnectorMasterTable;
DROP TABLE RestConnectorMasterTable;
NEXT vMes ;
NEXT vAnio ;
exit Script;
It doesn´t work with Set for me, dw I already figured it out
As an addition to this topic, I'm excited to share my latest tutorial on integrating Asana with Qlik Cloud using REST APIs!
In this step-by-step guide, you'll learn:
- How to use Asana REST APIs with Postman
- Creating REST Data Connections in Qlik Cloud
- Extracting data from Asana and saving as Parquet files
- Enhancing connections with custom parameters and pagination
Check out the full video on YouTube:
Integrate Asana with Qlik Cloud Using REST APIs: A Step-by-Step Guide
https://youtu.be/lFwar30BNkQ?si=UZoM_x9L5amdJSnf
Regards,
Mark Costa