Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
nareshthavidishetty
Creator III
Creator III

Dynamic logic

Hi,

We have an location field which having all locations but we have to capture only few locations which is to be static all the time.

Logic used :=if(location_new<>'016' and location_new<>'025' and location_new<>'099',location_new)

But the new locations got updated frequently so here am not able to capture only the locations which i required.

Locations need to static every time even if the new locations added = 012,034,045,067.

Thanks..

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Try this,

=If(Match(location_new,'012','034','045','067'),location_new)

Also, don't forget to enable the option "Suppress When Value Is Null".

View solution in original post

11 Replies
Chanty4u
MVP
MVP

try this

=if(location_new<>'016' or  location_new<>'025'  or location_new<>'099','Location_New) as    newlocation

Anonymous
Not applicable

easiest way would be to define a variable like this:

let vLocNew = '016;025;099';

and test if (match(Location_new, vLocNew)=0

will be tru if Location_new doesnot contain any of the Locations defined in variable

alternatively you may define the new Locations in an Excel list and read this list into a variable

migueldelval
Specialist
Specialist

Hi nareshthavidishetty,

I can´t understand you so well, but Ithink that you can use a variable to make it.

Your variable or variables can represent the values that you want to exclude or show.

Regards

Miguel del Valle

nareshthavidishetty
Creator III
Creator III
Author

Hi,

I need to show the data for the locations = 012,034,045,067 every time even if the new locations added to the filed.

The logic which we were used(=if(location_new<>'016' and location_new<>'025' and location_new<>'099',location_new)) is not dynamic like when ever an new location added to the field the new location will also show the results.

Result required : My chart should show the data only for(012,034,045,067 ) even if new locations added to the field.

Thanks..
Anonymous
Not applicable

then this should work

let vLocNew = '012;034;045;067';

if (match(location_new, vLocNew)>0, location_new

only the 4 defined Locations will be displayed, even if 10 locations exists

nareshthavidishetty
Creator III
Creator III
Author

Hi,

We used the logic as dimension ,it gives empty results =if (match(location_new, vLocNew )>0, location_new)

But when check the variable alone it show the right results.

Thanks..

Anonymous
Not applicable

does it work when you select only 1 Location?

in a straight table with Dimension Location_new it should work

in a textobject it should work when you select only 1 Location

when no or several locations are selected the if Expression will not work

can you explain your requirements?

nareshthavidishetty
Creator III
Creator III
Author

Hi,

After the logic used in dimension we were getting no results as below Untitled.png

Chart used: straight table

Logic used: =if (match(location_new, vLocNew )>0, location_new)

Thanks..

tamilarasu
Champion
Champion

Try this,

=If(Match(location_new,'012','034','045','067'),location_new)

Also, don't forget to enable the option "Suppress When Value Is Null".