Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
paul_hallwood
Contributor II
Contributor II

Setting a Variable Definition In Script

I'm trying to create a variable within script that will then display this variable in a text box.  Currently in the script I have:

SET varData_Status_Year='=[Year] & '/' & ([Year] + 1)';

(where [Year] is the year selected by the user)


The output I am trying to get is e.g. 2013/2014

But when I reload the information and look at the textbox, all I get displayed is the text =[Year] & '/' & ([Year]+1) despite assigning the variable varData_Status_Year to the textbox.  It's as if the definition of the variable hasn't been evaluated.


Any ideas warmly welcome.  Can I even concatenate existing fields with text to create a variable???

1 Solution

Accepted Solutions
Anonymous
Not applicable

10 Replies
Anonymous
Not applicable

Try this:

SET varData_Status_Year=[Year] & '/' & ([Year] + 1);

ashfaq_haseeb
Champion III
Champion III

Hi use let instead of set

LET varData_Status_Year=[Year] & '/' & ([Year] + 1);

Regards

ASHFAQ

paul_hallwood
Contributor II
Contributor II
Author


Hi Michael - just tried that and I get the same as what I was getting previously but without the single quote at the start and end.

paul_hallwood
Contributor II
Contributor II
Author

With your suggestion Ashfaq, I just get a forward slash being displayed in the textbox.

Anonymous
Not applicable

What exactly is in your text box?

varData_Status_Year

or

=varData_Status_Year

or

=$(varData_Status_Year)

?

ashfaq_haseeb
Champion III
Champion III

Hi,

Select at least one year.

Regards

ASHFAQ

paul_hallwood
Contributor II
Contributor II
Author

The second one of your options i.e. =varData_Status_Year

I have tried the other two options but they haven't given me what I wanted either.

paul_hallwood
Contributor II
Contributor II
Author

Hi Ashfaq,

I have selected one year and this doesn't change anything unfortunately.

Anonymous
Not applicable

See attached