Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, I would like to download a file from a "dynamic" URL every year.
I created a dataconnection for this:
IDENTIFICATION
Name: Feiertage
Connection String: https://www.feiertage.net/csvfile.php?state=NW&year=2021&type=csv
Type: Internet
With this URL I can download the holidays for 2021. The link also works.
But because I don't want the year 2021 to be static, but always the current year, I convert the URL in the load script.
vURL = 'https://www.feiertage.net/csvfile.php?state=NW&year=';
vaktuellesJahr = Year(Date(Today()));
vType = '&type=csv';
NoConcatenate
TMP1:
Load
Tag
,Year(Date(Tag)) as Feiertag_Jahr
,Feiertage
,Bundesland
From [lib://Feiertage]
(url is [$(vRoot)$(vaktuellesJahr)$(vType)], txt, codepage is 28591, embedded labels, delimiter is ';', msq);
With "(URL is...)" I change the URL and insert the current year (vaktuellesJahr).
When I load the data afterwards, I get the following error message:
Cannot open file: 'https://www.feiertage.net/csvfile.php?state=NW&year=2023&type=csv' (Connector error: badPath)
But the path is correct. If I copy this out of the error message, I can download the file without any problems.
How can help me, please?
Hi @reporting_neu, I am using Qliksense cloud and unable to find the web connector in my data connection. I tried to achieve it through the REST API.
to create a REST API connection I used this Connection String: https://www.feiertage.net/csvfile.php?state=NW&year=2021&type=csv.
Year will be dynamically changed once connection is established.
set vURL = 'https://www.feiertage.net/csvfile.php?state=NW&year=';
let vaktuellesJahr = Year(Date(Today(1)));
set vType = '&type=csv';
LIB CONNECT TO 'Feiertage';
TMP1:
Load
Tag
,Year(Date#(Tag,'DD.MM.YYYY')) as Feiertag_Jahr
,[ Feiertage] as Feiertage
,[ Bundesland] as Bundesland
;
SQL SELECT
"Tag",
" Feiertage",
" Bundesland"
FROM CSV (header on, delimiter ";", quote """") "CSV_source"
WITH CONNECTION
(
URL "$(vURL)$(vaktuellesJahr)$(vType)"
)
;
Hi @reporting_neu, I am using Qliksense cloud and unable to find the web connector in my data connection. I tried to achieve it through the REST API.
to create a REST API connection I used this Connection String: https://www.feiertage.net/csvfile.php?state=NW&year=2021&type=csv.
Year will be dynamically changed once connection is established.
set vURL = 'https://www.feiertage.net/csvfile.php?state=NW&year=';
let vaktuellesJahr = Year(Date(Today(1)));
set vType = '&type=csv';
LIB CONNECT TO 'Feiertage';
TMP1:
Load
Tag
,Year(Date#(Tag,'DD.MM.YYYY')) as Feiertag_Jahr
,[ Feiertage] as Feiertage
,[ Bundesland] as Bundesland
;
SQL SELECT
"Tag",
" Feiertage",
" Bundesland"
FROM CSV (header on, delimiter ";", quote """") "CSV_source"
WITH CONNECTION
(
URL "$(vURL)$(vaktuellesJahr)$(vType)"
)
;
Perfect! Thank you so much! 🙂