Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
dineshsingh
Partner - Contributor III
Partner - Contributor III

Qlik Sense: How to create a variable that can be used at front end?

Please suggest a way to create variables without calling generic objects API.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

The expression only(Date) is meaningless in the script. It will evaluate to Null and that means the variable won't exist after the script is finished. Perhaps you want to create a variable in the script containing the expression Only(Date) and you want to use that in the front end. If so you need to use SET instead of LET: SET vSelectedDate = Only(Date);. You can then create a measure to use the variable: =$(vSelectedDate)


talk is cheap, supply exceeds demand

View solution in original post

7 Replies
Gysbert_Wassenaar

Create them in the Data load editor:

SET vMyVariable = 1;

Then reload the document.


talk is cheap, supply exceeds demand
dineshsingh
Partner - Contributor III
Partner - Contributor III
Author

Thanks Gysbert,

Can we use LET instead of SET in case when we have to first evaluate expression?

Gysbert_Wassenaar

Yes, you can use LET too.


talk is cheap, supply exceeds demand
engishfaque
Specialist III
Specialist III

Dear Dinesh,

SET => Just assign value to the variable as a literal.

LET => First Evaluate the expression and then assign to variable.

Kind regards,

Ishfaque Ahmed

dineshsingh
Partner - Contributor III
Partner - Contributor III
Author

Main.jpg

I got problem in using LET. I have described my problem in the image above, please help me.

Gysbert_Wassenaar

The expression only(Date) is meaningless in the script. It will evaluate to Null and that means the variable won't exist after the script is finished. Perhaps you want to create a variable in the script containing the expression Only(Date) and you want to use that in the front end. If so you need to use SET instead of LET: SET vSelectedDate = Only(Date);. You can then create a measure to use the variable: =$(vSelectedDate)


talk is cheap, supply exceeds demand
dineshsingh
Partner - Contributor III
Partner - Contributor III
Author

Dear Gysbert,

Thanks for the reply. Can you please suggest an solution for the same.