Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Finding if value exists inside field

I have a field called CitiesWithFactory. It contains cities that have cars in the factory of the city.

for example I have New York, London and Berlin, if Berlin doesn't have any cars at the moment the field would look like this:

CitiesWithFactory: New York, London

I have a button for each city which I want to disable if there are no cars in it.

How do I check if the field contains the city?

Tags (3)
4 Replies
MVP
MVP

Re: Finding if value exists inside field

Maybe like

=Count({1<CitiesWithFactory *= {'Berlin'} >} CitiesWithFactory) >0

hrlinder
Honored Contributor

Re: Finding if value exists inside field

you can use function FindOneOf

for each button you can define

if (FindOneOf(CitiesWithFactory,'Berlin')>0   if Berlin is in List it Returns the Position of the text, otherwise 0

you can use conditional layout to Show or hide button

Re: Finding if value exists inside field

I think it could be helpful if you splitted this field within the script, for example with a subfield-function like:

table:

Load

     ID, /* relation to other tables probably per datefield and others*/

     subfield(CitiesWithFactory, ',') as CitiesWithFactory,

     SomeOtherFields

From xyz;


Often it's easier to use normal fields and not such combined values which it make only difficult without any further value.

- Marcus

MVP
MVP

Re: Finding if value exists inside field

Actually that's what I assumed - that your field CitiesWithFactory has several values, one for each city, not a single concatenated value.

Both versions should be supported by

=WildMatch( Concat(DISTINCT CitiesWithFactory, ', '), '*Berlin*') >0

Community Browser