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: 
jessica_webb
Creator III
Creator III

Variable as string in script

I have a variable in my script as follows:

Set vAcadyear = 2016-17;

I then use this in several other places in my script (mostly in file names) which works just fine.

So

FROM

[$(vAcadyear)\Misc\Map.xls]

(biff, embedded labels, table is Points$);

Becomes

FROM

[2016-17\Misc\Map.xls]

(biff, embedded labels, table is Points$);

which is exactly what I want.

However, in another place in the LOAD statement I have:

LOAD

$(vAcadyear) as Year,

And that's not working as I want. In this case, it evaluates the variable, and gives me '1999' as 'Year' (i.e. 2016 minus 17!)

How do I get it to store this variable as a string, even though it "looks" like a calculation.

Thanks,
Jess

16 Replies
jessica_webb
Creator III
Creator III
Author

Nope, still gives me '1999' as a value.

I'll upload a sample file on here.

PrashantSangle

Yes it is working properly.

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
jessica_webb
Creator III
Creator III
Author

I don't want it to say '1999' though. I want it to say '2016-17'

tyagishaila
Specialist
Specialist

try it,

LOAD

'$(vAcadyear)' as Year,

Anonymous
Not applicable

Maybe: '$(vAcadyear)' as Year?

PrashantSangle

Hi,

try with single quote

Let vAcadyear = '2017-16';

Load ID,'$(vAcadyear)' as Year INLINE [

ID

1

2

];

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
jessica_webb
Creator III
Creator III
Author

Thank you Shaila, that works perfectly