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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set multi values to field via macro

Hi,

Does anyone know how to set multi values to a specific field via a macro VBScrip?

I want to create a macro that will select the values "Dad" and "Mom" at the field named "Pos".

I'v tried:

SUB SET_POS

ActiveDocument.Fields("Pos").Select "Dad", "Mom"

END SUB

But it won't do.



1 Solution

Accepted Solutions
Not applicable
Author

Select only allows one value and it deselects all other values. You need ToggleSelect. ToggleSelect will select a value and keep the current selections. If the value is already selected, it will unselect it.

ActiveDocument.Fields("Pos").Select "Dad"
ActiveDocument.Fields("Pos").ToggleSelect "Mom"


View solution in original post

2 Replies
Not applicable
Author

Select only allows one value and it deselects all other values. You need ToggleSelect. ToggleSelect will select a value and keep the current selections. If the value is already selected, it will unselect it.

ActiveDocument.Fields("Pos").Select "Dad"
ActiveDocument.Fields("Pos").ToggleSelect "Mom"


Not applicable
Author

Thanks, this is what I was looking for.