Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
rmarquescampos
Contributor
Contributor

Create a filter using key terms

I have a data that is not structured. I want to create a fixed list of terms that will search the value in different fields.
For exemple, the list is based in key words of fruits (apple, banana and orange). So, when I select one of these fruits, it will search the columns [column A] [column B] [column C]. If they have any value that correspond to it, it will be filtered in.
Column A is not structured at all. It is a summary, so, it will have complete phrases, like. "I like banana".
And if the filter finds the value on any of the 3 columns, it should filter in.

Labels (1)
1 Solution

Accepted Solutions
marksouzacosta
Partner - Specialist
Partner - Specialist

There are multiple ways to solve this problem. I believe you are looking for something more controlled so maybe you can use Button Actions to do that.

So, here is my Load Script. I'm loading data from the Snowflake sample database and a custom list of Terms. Those terms will be used in our search:

 

LIB CONNECT TO [SnowFlakeSample];

[CUSTOMER]:
SELECT "C_CUSTKEY",
	"C_NAME",
	"C_ADDRESS",
	"C_NATIONKEY",
	"C_PHONE",
	"C_ACCTBAL",
	"C_MKTSEGMENT",
	"C_COMMENT"
FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER";

FilterTerms:
LOAD * INLINE [
Term
nod
regular
beans
BUILDING
];

 

 

And this is the user interface:

marksouzacosta_0-1718930942581.png

The button has two actions, one search for each field that I want to search the selected value - in your case will be three:

marksouzacosta_1-1718931808565.png

 

This is the action configuration:

marksouzacosta_2-1718931834480.png

This is the Value expression:

 

='*' & MaxString(Term) & '*'

 

I setup it to get the latest value in alphabetical order available in the Term field (that is why the MaxString).
You can manipulate it to support multiple Terms using some concatenate function.

If you select beans in Term and click on Search button, it will filter the values on column C_COMMENT or C_MKTSEGMENT:

marksouzacosta_3-1718932275740.png

 

Read more at Data Voyagers - datavoyagers.net

View solution in original post

3 Replies
Lisa_P
Employee
Employee

Try using the smart search for this

 

marksouzacosta
Partner - Specialist
Partner - Specialist

There are multiple ways to solve this problem. I believe you are looking for something more controlled so maybe you can use Button Actions to do that.

So, here is my Load Script. I'm loading data from the Snowflake sample database and a custom list of Terms. Those terms will be used in our search:

 

LIB CONNECT TO [SnowFlakeSample];

[CUSTOMER]:
SELECT "C_CUSTKEY",
	"C_NAME",
	"C_ADDRESS",
	"C_NATIONKEY",
	"C_PHONE",
	"C_ACCTBAL",
	"C_MKTSEGMENT",
	"C_COMMENT"
FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER";

FilterTerms:
LOAD * INLINE [
Term
nod
regular
beans
BUILDING
];

 

 

And this is the user interface:

marksouzacosta_0-1718930942581.png

The button has two actions, one search for each field that I want to search the selected value - in your case will be three:

marksouzacosta_1-1718931808565.png

 

This is the action configuration:

marksouzacosta_2-1718931834480.png

This is the Value expression:

 

='*' & MaxString(Term) & '*'

 

I setup it to get the latest value in alphabetical order available in the Term field (that is why the MaxString).
You can manipulate it to support multiple Terms using some concatenate function.

If you select beans in Term and click on Search button, it will filter the values on column C_COMMENT or C_MKTSEGMENT:

marksouzacosta_3-1718932275740.png

 

Read more at Data Voyagers - datavoyagers.net
rmarquescampos
Contributor
Contributor
Author

That was what i was looking for. Do you know how can i do that concatenate function? I'm new to qlik sense and I'm having some trouble doing it.