Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
jmurrevcyc
Contributor III
Contributor III

QlikSense Load Script

I am new to Qlik Sense, and have been tasked with automating some processes using load script.

I have set up some variables as follows, which I want to call out in the load script as fields:

The problem I am running into is the script interprets the '/' and '-' as operators, and I just want it to insert the data as is.

Let vYr = '2022';
Let vCalendarDate = date('10/31/2022'); //I have tried this without formatting as date, and also as chr, but doesn't work \
Let vYrMo = '2022-10';

In the load script I am trying to do this

load 

$(vYr) as "Yr",
$(vCalendarDate) as "CalendarDate",
$(vYrMo) as "Yr-Mo"

The vYr resolves through ok as 2022 since there are no operators to confuse it.

However, the vCalendarDate resolves like it is trying to divide 10/31/2022 and not display it as a date. I just want it to be '10/31/2022'.

The vYrMo resolves like it is taking the number 2022 - 10 and giving 2012. I just want it to be '2022-10'.

I would like to understand how to properly define the variable or reference the variable in the load script so it doesn't recognize the '/' and '-' as operators, but can't seem to figure it out.

 

Thanks,

 

 

 

Labels (2)
1 Solution

Accepted Solutions
Yorick_Stevens
Partner - Contributor III
Partner - Contributor III

Dear Jmurrevcyc,

When using variables you'll need to define
- if you want to load them as a field (using [ ]) if you want to let your script look for the field [2022-10]
- or take the variables as plain text, (using ' ') which is what you are looking for

can you try:

oad 

'$(vYr)' as "Yr",
'$(vCalendarDate)' as "CalendarDate",
'$(vYrMo)' as "Yr-Mo"

Kind regards

View solution in original post

1 Reply
Yorick_Stevens
Partner - Contributor III
Partner - Contributor III

Dear Jmurrevcyc,

When using variables you'll need to define
- if you want to load them as a field (using [ ]) if you want to let your script look for the field [2022-10]
- or take the variables as plain text, (using ' ') which is what you are looking for

can you try:

oad 

'$(vYr)' as "Yr",
'$(vCalendarDate)' as "CalendarDate",
'$(vYrMo)' as "Yr-Mo"

Kind regards