Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
andre_ficken
Partner - Creator
Partner - Creator

How can I make use of the result of getfieldselections() in a wildmatch()

Hi There,

Is there anyone who has tried to use the result of getfieldselections(field, separator) in a wildmatch(string, searchitems)??

What needs to be done is that the result of getfieldselections() has to be reformatted to fit the searchitems part of the wildmatch().

The problem I run into is that the separator is a comma and that needs to be replaced by a <', '> but how can I do this when the parameter open and close char is a single quote as well??

Any ideas to get this working??

Thanks in advance for your inputs.

5 Replies
andrey_krylov
Specialist
Specialist

=Match(String, $(=Chr(39)&GetFieldSelections([SomeField], Chr(39)&Chr(44)&Chr(39))&Chr(39)))

chrismarlow
Specialist II
Specialist II

Andre,

Not sure if this helps, but in a simple model with 3 lines of data & dimension field Dim I can define GFS as

=chr(39)&GetFieldSelections(Dim,chr(39)&','&chr(39))&chr(39)

& RESULT as

=WildMatch(TEST,$(GFS))

& then as I change TEST get the change in index as below;

313553.png

Any use?

Regards,

Chris.

andre_ficken
Partner - Creator
Partner - Creator
Author

Hey Andrey,

Thanks for your reply. I worked with it and got it to work as well. Only problem is that it will only work when your field selection only needs to match 1 test value. In my situation I have a field (String) that holds multiple selection field (SomeField) values, which actually means that I am actually looking for either one selected value of SomeField that are present in String. After testing and playing with this for a bit I understood that there can only be 1 value in SomeField. So unfortunately I cannot use the match or wildmatch to resolve my requirement.

I ultimately managed to build a solution based on a re-use and re-model of an existing table in the app that functions as a selection list with a direct link to the items in which it is present.

andre_ficken
Partner - Creator
Partner - Creator
Author

Hi Chris,

Please check the comments I posted on Andrey's reply.

Thanks for your help, it is useful info that I will be able to use elsewhere.

Txs, André

marcus_sommer

It will also work with multiple items. Probably you have just some small syntax-issue. Quite helpful is to use a textbox to playing with the comma- and quotes-stuff until the string looked like you would have written it manually. Then the logic could be transferred into the $-sign expansion which is then needed within the match-expression. Beside the getfieldselections() you could also use concat() to build such a string.

An alternatively to this approach might be to transfer the filter-logic into a set analysis condition and which might be look like: sum({< FIELD = p(FIELD)>} VALUE).

- Marcus