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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

GetRelevantSelections - returning selections from other object!

I am trying to form a text string based on multiple selections from a listbox. Here is the code -

sub assignUsers
set obj = ActiveDocument.GetSheetObject("LB25")
xusers=obj.GetRelevantSelections
if ActiveDocument.GetSheetObject("LB25").GetField.GetFieldFlags.HasSelection then
msgbox(xusers(0))
ActiveDocument.Variables("requestUser").SetContent right( xusers(0), len(xusers(0))- 9 ), true
else
ActiveDocument.Variables("requestUser").SetContent "No users selected", true
end if
end sub

Srangely, what gets into 'xusers' is selection from one of my other listboxes - LB22! I verified this by inserting a msgbox statement.

Could somebody pl help!



1 Reply
Not applicable
Author

found the cause. i was assuming that the selection i want would always be at the first spot in xusers array. i modified the code -

sub assignUsers
set obj = ActiveDocument.GetSheetObject("LB25")
xusers=obj.GetRelevantSelections
if ActiveDocument.GetSheetObject("LB25").GetField.GetFieldFlags.HasSelection then
for i = lbound(xusers) to ubound(xusers)
if (left(xusers(i),11)="reqUserName") then
msgbox(xusers(i))
ActiveDocument.Variables("requestUser").SetContent right( xusers(i), len(xusers(i))- 11 ), true
end if
next
else
ActiveDocument.Variables("requestUser").SetContent "No users selected", true
end if
end sub

seems to work... BUT

after 6 selections in my listbox, instead of listing the selected values, it just gives me the count - "7 of 1616"

what do i need to do to continue to get all the selected values?