Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
CNH_1978
Contributor II
Contributor II

Native MAP object conditional show

Hi all,

I have created a map using the native object, i have a number of layers that i want to show/hide based on a user selection. 

I have created a field for the user selection..i.e.

ViewLayer:

Load * inline [

ViewLayer

Layer1

Layer2

Layer3

];

The user can then select 1 or more layers from the field which i then want to show or hide in the map.

I am then using the following expression within the 'Calculation Condition' against each layer..

SubStringCount(Concat([ViewLayer], '|'), 'Layer 1')

If i use the above expression in a text object it return 1 (when nothing is selected from the ViewLayer field, however, if i do the same in QlikView, 0 is displayed unless i actually make a selection and select Layer 1. It seems that in QS it counts the value even its its a possible value whereas in QV it only counts it if selected. 

I can get around this by creating separate fields for each layer, but then that means that the user will have to make selections on multiple fields instead of a single field (not very user friendly).

 

Does anyone know of a workaround where i can use a single field for the user to select. 

What i want is for the map to hide all layers unless they are selected from the field. 

Note that the user can make multiple selections, which is why i am using the concat() function in the expression above. 

I have attached a QVF with a sample. 

Any help would be appreciated. 

I am using version FEB 2020

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hi 

it's quite simple 

use this expression instead :SubStringCount(Concat(GetFieldSelections([Layer Selection]), '|'), 'Layer 1')

View solution in original post

1 Reply
lironbaram
Partner - Master III
Partner - Master III

hi 

it's quite simple 

use this expression instead :SubStringCount(Concat(GetFieldSelections([Layer Selection]), '|'), 'Layer 1')