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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
qolkaram
Contributor III
Contributor III

Assign value to Multibox Items

Hello ,

i want to assign value to multibox items based on another multibox selected items .can any body help me on this ?

regards

20 Replies
ganeshsvm
Creator II
Creator II

add it inside the search substring textbox as,

=if(getselectedcount(Company)>0,chr(39)&GetFieldSelections(Company,chr(39)&','&chr(39))&chr(39))

qolkaram
Contributor III
Contributor III
Author

can you please check attached file ,i have done the same but it is not working.

avinashelite

ass it in the search string place

ganeshsvm
Creator II
Creator II

Sorry, I have QV personal edition, so cannot open your doc.

Image/sample data or the script will do it.

kuba_michalik
Partner - Specialist
Partner - Specialist

First, you are using alternate states. You need to specify which alternate state the action applies to, it's next to the Delete button in action settings (presumably, Ad Hoc state).

Second, I don't think this search string will work, because one does not simply put quotes in search strings (unless one explicitly wishes to search for quotes). Use this formula instead:

=if(GetSelectedCount(Company)>0,'('&GetFieldSelections(Company,'|')&')')

This will return current selections (without quotes) separated by | and wrapped in parentheses, which is the search string syntax for "or".

MK9885
Master II
Master II

It is not working cus there is no link between tables/fields in your data model. That might be the issue.

qolkaram
Contributor III
Contributor III
Author

thanks ,the expression is working at least when one item is selected but what should i do for muti selection scenario?

ganeshsvm
Creator II
Creator II

You can try this code snippet also, for multiple or single selection.

=if(GetSelectedCount(Company) >0,'(' & Concat(Distinct Company, '|') & ')')

Not applicable

Please explain your requirement so that it will be easier for us to understand also share the sample data.

kuba_michalik
Partner - Specialist
Partner - Specialist

Nothing. This will work for multiple selections as well, try it. Only issue is that GetFieldSelections function will return results like "7 of 22 selected" if there are too many values selected. That can be worked around with third argument, which specifies after how many values it should switch to the shortened form:

=if(GetSelectedCount(Company)>0,'('&GetFieldSelections(Company,'|',FieldValueCount('Company'))&')')


(the selection limit is set to be equal to number of values in the field)


Alternatively, you can use the version with Concat as suggested by Ganesh.