Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
senpradip007
Specialist III
Specialist III

Try this

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

Not applicable
Author

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

syukyo_zhu
Creator III
Creator III

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

p_verkooijen
Partner - Specialist
Partner - Specialist

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.

senpradip007
Specialist III
Specialist III

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

Not applicable
Author

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

ssanchez
Partner - Contributor III
Partner - Contributor III

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'))

bgerchikov
Partner - Creator III
Partner - Creator III

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