Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
vsabbise
Creator
Creator

Compare 2 WildMatch outputs

I am looking for a solution to compare 2 WildMatch outputs in Qlik Sense Expression. In fact a way to code nested WildMatch .

I have my first list of id's generated by first Wildmatch expression And Second list of Id's generated by Second Wildmatch expression

Now I want common Id's from either of the lists

Ex: I want something like below:

=if (   wildmatch(

     if(WildMatch(File_Text_2,'$(vFileText2)*'),id_2),     if(WildMatch(File_Text,'$(vFileText)*'),id_1)

                       ),id_1)

Explanation:

if(WildMatch(File_Text_2,'$(vFileText2)*'),id_2)  : This generates list of id_2

if(WildMatch(File_Text,'$(vFileText)*'),id_1)            : This generates list of id

Now I want to list the common id's that are present in both the lists id_2 & Id_1

1 Solution

Accepted Solutions
swuehl
MVP
MVP

So basically you have one column with text and one with IDs?

In a filter pane, try something like

=Aggr( Only({<ID = p({<Text = {"$(vText1)*"}>}) * p({<Text = {"$(vText2)*"}>}) >} ID), ID)

Or in a chart expression to get the concatenated common IDs:

=Concat({<ID = p({<Text = {"$(vText1)*"}>}) * p({<Text = {"$(vText2)*"}>}) >} DISTINCT ID,', ')

View solution in original post

30 Replies
swuehl
MVP
MVP

Can't really see how one or the other expressions used will create a list of IDs when used in a Qliksense expression.

Can you maybe upload a small sample QVF with some sample records that show your current status?

vsabbise
Creator
Creator
Author

Hi Stefan,

Thanks for your response. I am using the expression inside a filter pan to display the list of ID's.

For Example: " =if(WildMatch(File_Text,'$(vFileText)*'),id)  " This expression when used in a filter pan lists all the id's in my filter pane when my input box(vFileText) string match with the string present in m field(File_text). Thus I can select/un select the ID's i wanted.

swuehl
MVP
MVP

Ok, so you are using these expressions as calculated dimensions.

How does your data model look like? What's the relation between  the IDs and the File texts?

vsabbise
Creator
Creator
Author

Correct I am using expressions as calculated dimensions. Is there a way to save the output of the expression in a variables and compare and generate a list of common ID's ?

I can literally see what are some of the common ID"s from both the filter panes but wanted to list the common fields.

Regarding Data model, Its a many to many relationship between ID and File Texts.

swuehl
MVP
MVP

Ok, but what is the relation between the two ID fields? Are they located in one table or in different tables, linked to each other or unlinked?

vsabbise
Creator
Creator
Author

They are in one table. ID_2 is just a duplicate of ID_1. I created a duplicate column wondering it would make my task easier.

prieper
Master II
Master II

Think that there is a misunderstanding of the WILDMATCH. Actually this function delivers just one value (or NULL) indication the position of the search-values.

vsabbise
Creator
Creator
Author

Thanks Peter.

I was using if(WildMatch(File_Text_2,'$(vFileText2)*'),id_2)  expression in the filter pane and I was able to see the list of id_2.


I wonder if the output of WildMatch is either a position/Null then how come the " if statement " is able to convert the output to boolean.

prieper
Master II
Master II

Actually do not think that this formula may work.

Can you post some examples please?

If you wish to compare data, you may rather check the EXISTS-function (or probably work with JOINs).

Peter