Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
jagannalla
Partner - Specialist III
Partner - Specialist III

Selected field value should store in variable

Hi,

I had three fields they are Group,Min,Max from one table. I had taken Group as field in the listbox,Min & Max as expression in same listbox like followin image:

Capture.PNG

- Now i want to store Min value of A in one variable and Max value in another variable after marking A

- If i select B i want to store Min value of B in one variable and Max value in another variable.

The four variables are like this vMInA,vMaxA,vMinB,vMaxB.

How to solve this problem

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   For vMinA Assign this value   '=min({<Group= {"A"}>}MinCure)

   For vMaxA Assign this value  '=max({<Cure = {"A"}>}MinCure)

  Use same thing for vMinB and vMaxB

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

14 Replies
Miguel_Angel_Baeyens

Hello,

Go to the Settings menu, Document properties, Triggers tab. Select the fields event and make a new action OnSelect and OnChange, External, Set Variable, select your variables and set the values using Min() and Max() functions.

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   For vMinA Assign this value   '=min({<Group= {"A"}>}MinCure)

   For vMaxA Assign this value  '=max({<Cure = {"A"}>}MinCure)

  Use same thing for vMinB and vMaxB

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
jagannalla
Partner - Specialist III
Partner - Specialist III
Author

kaushik,

But after selecting A it should assign a value to variable.

For eg:

1. if i select A then vMInA should hold the value 2 and vMaxA should hold the value 6. If it is unselected then vMinA,vMaxA should empty.

2. if i select B then vMInB should hold the value 1.58 and vMaxB should hold the value 1.65. If it is unselected then vMinB,vMaxB  should empty.

Miguel,

Your logic is good. But when i unselect the variable should be empty and one more think is what about vMinB variable

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Ok try this.

    for vMinA  '=if(wildmatch(GetFieldSelections(Group),'A''),min({<Group= {"A"}>}MinCure),0)

    Like wise use for other variable too.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Hi,

Thanks kaushik it's working...

Can you please solve the solution of last two posts in this link :- LastTwoPosts

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Can you please mark this post as answered.

Regards,

Kaushik Solanki

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

Hi jagannalla,

just adding a note:

If you want a multiselect (like in your screenshot in OP), you need to use wildcards for the wildmatch (i.e.  wildmatch(GetFieldSelections(Group),'*A*') or use index function instead.

(Group names must be unique even in part then)

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

swuehl,

Yeah..dat's good idea thanks for giving information buddy.

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Hi ,

vMinA =if(wildmatch(GetFieldSelections(Group),'A''),min({<Group= {"A"}>}MinCure),'')

The above code is not working when i select A & B in the listbox at a time...