Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

biob_stein
Not applicable

How to check if a value exist in a listbox

Dear Community,


with an expression i simply want to check if a value exists inside a listbox.

How can this be done?

Example:

Data: 

Load *,DepthSN As DepthSN_New Inline [ 

Producer, DepthSN 

p1,aaa 

p2,bbb 

p3,ccc ]; 

How to check that the value 'aaa' exists inside 'Data'?

Tags (2)
1 Solution

Accepted Solutions
Clever_Anjos
Not applicable

Re: How to check if a value exist in a listbox

Count({<DepthSN ={"aaaa"}>} DepthSN ) > 0

4 Replies
sunny_talwar
Not applicable

Re: How to check if a value exist in a listbox

You can use a expression like this in a list box:

=If(SubStringCount(Concat(DISTINCT DepthSN,'|'), 'aaa') = 1, 'aaa exists', 'aaa does not exist')

This will change results based on your selection. So for instance if you don't select 'aaa' in your list box it will say aaa does not exist. If you don't want that you can change the expression to this:

=If(SubStringCount(Concat({1}DISTINCT DepthSN,'|'), 'aaa') = 1, 'aaa exists', 'aaa does not exist')

HTH

Best,

Sunny

Clever_Anjos
Not applicable

Re: How to check if a value exist in a listbox

Count({<DepthSN ={"aaaa"}>} DepthSN ) > 0

biob_stein
Not applicable

Re: How to check if a value exist in a listbox

Thanks for your answer,

unfortunately concat is not good, if you have million of rows

sunny_talwar
Not applicable

Re: How to check if a value exist in a listbox

I think you are right. Clever Anjos‌'s solution seems to be much more efficient.

Best,

Sunny