Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Evan0211
Creator II
Creator II

Setting a basic string variable in load script

I am working on a new app and trying to focus on using the load script to load all of my variables.

I have a basic category variable that I want to set equal to Books so I did this:

SET vCategory = 'Books';

When I am doing a sum on the category, I am doing this:

=sum(If(
([Category] =  $(vCategory) 
)
,
[VALUE]))

However, this is expressing to if [Category] = Books (without the single quotes around the variable value. How do I get it to see the variable as a string?

Labels (1)
1 Reply
Kushal_Chawda
MVP
MVP

@Evan0211  try to use it in set expression instead

=sum({<
[Category] = {'$(vCategory)'}
>}
[VALUE])