Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Not applicable

I cant understand the Following Expression which is used in Triggers?can any one Explain me Clearly so that it will be help full for me

Hi all,

As per my requirements, the following Expression is working I got the output but I cant understand the logic of the expression

the Expression used in document trigger:

=if(GetSelectedCount(Year)>3 or GetSelectedCount(Year)=0 , year(Today()), '(*' & GetFieldSelections(Year,'*|*') & '*)')  

Please find the Following Requirements.

  1. I need 2017 year data to be selected as default even after giving Clear all(if I give clear all 2017 should always be selected).

Screenshot_3.png

   2. I want to select only three years or less than three years.If I select More than Three years it need to be automatically back to the              Default Year(ie) 2017

Note: if I select less than three years the dashboard should change.but if I select more than three years the dashboard should not be changed. it need to be automatically back to the Default Year(ie) 2017Screenshot_1.png

Screenshot_3.png

For the Above Requirements, i have used following Expression in Document Triggers (On Any Select Trigger). it is working fine but I can't understand the else part of the expression. can anyone explain to me so that I would be help full for my learning process

=if(GetSelectedCount(Year)>3 or GetSelectedCount(Year)=0 , year(Today()), '(*' & GetFieldSelections(Year,'*|*') & '*)')  

Thanks

Muthu

1 Reply

Re: I cant understand the Following Expression which is used in Triggers?can any one Explain me Clearly so that it will be help full for me

When you need multiple values to be used in the string part of the Select actions, the syntax must be

(Value1|Value2|Value3)

So when that action triggers, it will select all "Value1", "Value2" and "Value3". You can also use wildcards as you will use to search using the magnifying glass icon or just typing on a search object or listbox:

(*alue1*|*alue2*)

So you can get both "Value1" and "value1" (note the case sensitive of the values)

The else part of your If() condition selects in the field all fields selected in Year, in the format mentioned above, for example, (*2015*|*2016*).

Still, it is redundant if in your case selections can be only done in field "Year", as whatever possible years will be considered for the selection anyways (white values)