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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
jagannalla
Partner - Specialist III
Partner - Specialist III

Selections of listbox(expression) store in variable

Hi,

I've a list box with field with presentation LED CheckBoxes. Now i want to store marked values of this listbox into variable to achive this i taken button action with variable and give value for this variable with code =GetFieldSelections(Group,',',20).

Upto here it is fine. If i taken expression in the listbox it is not able store selections. How can i overcome this.

6 Replies
erichshiino
Partner - Master
Partner - Master

Hi,

I'm not sure why it didn't work.

I reproduce your sceneario and it is working.

Please, check attachment.

Hope it helps,

Erich

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Erich,

I'm using personal edition can say the procedure please.

erichshiino
Partner - Master
Partner - Master

Sorry... I think I got it wrong in the first time.

You need it to automatically store the selections without the button?

In this case,

You can go to setttings-> document Properties -> Triggers

Select your field, click on add Actions and the rest will be just like the button.

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Actually why i'm trying to do this  i had list boxes like following image:

Capture.PNG

- If i select Group in 1st listbox it should automatically select all data in 2nd listbox. i.e like this

Capture.PNG

- For this i return a macro based on listbox and to work this i return a expression in listbox.

- Is there any other solution to do this.

- The think is if i select Group it should automatically select all data in 2nd listbox and if i unselect Group it should deselect all the data in 2nd listbox.

- And user can choose again selection in 2nd listbox after selecting in 1st group.

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

But if listbox contains expression how can i achive this..

erichshiino
Partner - Master
Partner - Master

Ok,

Please include this code in your macro module:

SUB selPossible

    set val=ActiveDocument.Fields("GROUP").GetSelectedValues

    IF ( val.Count >0) THEN

        ActiveDocument.Fields("MEMBER").SelectPossible

    ELSE

        ActiveDocument.Fields("MEMBER").CLEAR

    END IF

end sub

It wil get selections in the field GROUP to apply in the FIELD MEMBER.

If the user de-select group, it will clear the MEMBER    

You should call this macro from the onSelect and onChange trigger of the field GROUP

(at settings->document properties -> triggers)

(You need to change the code to work with your own fields)

Hope this helps,

Erich