Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using getFieldSelection as search string

Hi, I have two listboxes testCase and testCaseByID, and right now I am using a trigger Select in Field, so that whenever someone selects a value from testCaseByID it selects in testCase and I do this by using getFieldSelection(testCaseByID) to change the field testCase. However, whenever someone selects multiple from testCaseByID, getFieldSelection doesn't work and nothing gets selected in testCase. Is there any other way to do this?

Thanks,

Natasha

4 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Natasha,

On your trigger, you should do something like this:

Selection on field so it can select the values on the other field and for exrpession, use this:

='(' & replace(GetFieldSelections(Client),',','|') & ')'

it replaces the string "A,B" for something like "(A|B)" that is the multiple string query.

Felipe.

Sample.png

marcus_sommer

Replace isn't necessary because getfieldselections() has a second parameter for it and the third parameter will define the max. number of the returning values because the global default-number is often not very high and by more selected values it would return something like 'x of y' or 'Not ...'.

- Marcus

marcus_sommer

An alternatively to your approach might be to associate both fields within the datamodel or if you really need a loosen table for selections you could refer to them per set analysis within the expressions with something like:

sum({< testCase = p(testCaseByID)>} AnyValue)

- Marcus

swuehl
MVP
MVP

How does your search string currently look like? I don't understand how a GetFieldSelections(testCaseByID)

returns the values for selection in testCase.

If both fields are linked in your data model, why not just use a Selection - Select possible action?

(If you really need to select the values, the associative logic should also work with just keep the values possible / white)