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

how to pass the current selection to variable.

Hi Friends,

i am unable to pass the current selections to variable.

i have a country column and i want to pass the values based on current selection to variable.

like if i select any country in the country list box it should pass the country variable

I have tried below variable it is not working

vCountry = GetFieldSelections(Country)


and the above variable i need to use below set expression like below mentioned.

sum({<type={'customer'},country={$(vCountry)}>})sales


Any can help me

Thanks,

Venkat

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Try this way.

Let vCountry = GetFieldSelections(Country,'","')

sum({<type={'customer'},country={"$(vCountry)"}>})sales

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

9 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Try this way.

Let vCountry = GetFieldSelections(Country,'","')

sum({<type={'customer'},country={"$(vCountry)"}>})sales

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
MK_QSL
MVP
MVP

Use as below


Variable

vCountry =IF(GetSelectedCount(Country),CHR(39)&Concat(DISTINCT Country,CHR(39) & ',' & CHR(39))&CHR(39),'')

Expression

=Sum({<type = {'customer'},Country={$(vCountry)}>}Sales)

sunny_talwar

But why do you even need it? QlikView by default will show you the data for the selected Country if you use this

Sum({<type={'customer'}>}) sales)

venkatbza
Creator
Creator
Author

Correct Sunny, But my requirement is different,

I need to create one more variable using below set expression. like

vCountryCalc =Sum({<type = {'customer'},Country={$(vCountry)}>}Sales)


and this variable i need to use in my chart expression.

venkatbza
Creator
Creator
Author

Thanks Manish,

it is working perfectly like what i am expecting.

venkatbza
Creator
Creator
Author

Thanks Kaushik, for you quick response.

sunny_talwar

But once again, why won't this work?

vCountryCalc =Sum({<type = {'customer'}}>}Sales)

venkatbza
Creator
Creator
Author

Hi sunny, I need a static values for the selected country, that's why i have to create a variable like below

vCountryCalc =Sum({<type = {'customer'},Country={$(vCountry)}>}Sales)

sunny_talwar

I guess I am still not sure what you are trying to do... but if it meets your requirement, who am I to complain

Best,

Sunny