Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

How to use if with GetFieldSelections?

Hi,

I This data:

Designation

SA

SE

SSE

AC

C

LC

I have taken a variable vDesigation, Wherein variable overview I have taken...

vDesignation=if(IsNull(GetFieldSelections(Designation)),'Overall',if(GetFieldSelections(Designation)= 'SA' or GetFieldSelections(Designation)='SE' or GetFieldSelections(Designation)='SSE','Low','High'))

This is not working.

I am Printing the value of vDesignation in text box, Where if SA or SE or SSE is selected in the designation filter it should display Low else High.

Thanks in advance,

Pratik

8 Replies
Highlighted
Specialist III
Specialist III

Try this

if(GetFieldSelections(Designation)= 'SA' or GetFieldSelections(Designation)='SE' or GetFieldSelections(Designation)='SSE','Low','High')

Highlighted
Not applicable

Thanks for the Reply but I am Using Isnull function to print the word overall when clear button is presses, i.e when no filters applied on the field designation

Highlighted
Creator III
Creator III

you can try " $(vDesignation) " in your text object

Highlighted
Partner
Partner

Use GetSelectedCount for checking if there is a selection active for Designation

IF(GetSelectedCount(Designation)=0,....

Note that if two ore more selections are made in Designation the result will be High.

You can't check for one value with IF(GetFieldSelections(Designation), you should use index or a different type of check.

Highlighted
Specialist III
Specialist III

When no filtter is applied GetSelectedCount(Designation) returns 0 and Overall will be flashed.

Highlighted
Not applicable

I want the syntax to check if Multiple values are selected, i.e by using if condition with GetFieldSelections

Highlighted
Partner
Partner

If the problem is a multiple selection in the Designation field, you can use the function SubStringCount. The variable vDesignation is defined as follows:

if(IsNull(GetFieldSelections(Designation)),'Overall',

  if(substringcount(GetFieldSelections(Designation),'SA')=1

  or substringcount(GetFieldSelections(Designation),'SSE')=1

  or substringcount(GetFieldSelections(Designation),'SE')=1,

  'Low',

  'High'))

Highlighted
Partner
Partner

I'd suggest to use MixMatch or Match functions:

If(getSelectedCount(Designation)=0,'Overall', If(MixMatch(GetFieldSelection(Designation),'SA','SE','SSE'),'Low','High'))

Hope it will help