11 Replies Latest reply: Apr 21, 2014 9:36 AM by Bumin Koesesoy

Conditional Expression

Hello,

I have a straight table where I want to put a condition on 4 of the expressions to say if these month are selected then show. I am able to do it for if just one month is showing i.e (Month=1) however I want to say if Month=(1,2,3) then show.

Thanks in advance.

• Re: Conditional Expression

Try getfieldselections() and/or getfieldselectionscount() to read or count the current selections.

- Marcus

• Re: Conditional Expression

=if(GetFieldSelections(Months)=1 or GetFieldSelections(Months)=2 or GetFieldSelections(Months)=3,Year,Week)

something like this can help you .

• Re: Conditional Expression

Neither of these work but thanks

• Re: Conditional Expression

Try it again - generally it will work. Perhaps you could also use a simple count-function about the month: if(count(distinct Month) = 3, true(), false())

- Marcus

• Re: Conditional Expression

Try the below expression in condition

=if(GetFieldSelections(Month)=1 and GetFieldSelections(Month)=2 and GetFieldSelections(Month)=3, 1, 0)

Thank you

Vardhan

• Re: Conditional Expression

That would work with ORs instead of ANDs.

• Re: Conditional Expression

ashishvardhan Thank You this works.

However I also want it to show if all 3 are selected can I do that in the same condition?

• Re: Conditional Expression

can i use the conditianal expression without selecting a value

from the table

 Obj Period 1 2 3 4 5 6 7 8 9 10 11 12 Total 1 100 200 150 120 170 200 220 250 180 170 140 120 2020 2 110 210 160 110 160 210 230 260 170 150 130 130 2030

I want to display only the periods 8 to 12 and the total column (having the periods 1 to 12)

can I do it with a condition in an expression?

• Re: Conditional Expression

You want this condition for whole chart/table or for particular some field or expression?

For whole Chart/Table use below in

Layout

Show - Condition

Month = 1 or Month = 2 or Month = 3

Or Try Below

=GetFieldSelections(Month) = 1 or GetFieldSelections(Month) = 2 or GetFieldSelections(Month) = 3

For Particular Expression...

Try as below

=IF(GetFieldSelections(Month) = 1 or GetFieldSelections(Month) = 2 or GetFieldSelections(Month) = 3,  SUM(Sales)))

• Re: Conditional Expression

Anna,

If you want the months 1, 2 and 3 to be selected to perform an action, you may simply do:

if( substringcount( concat(distinct Month, ','), '1,2,3') =1, your action or everything you want)

Concat() will create a string. Substringcount() will return 1 if OK, 0 if it does not find (in fact, this function returns the number of times it finds the expression)

Fabrice

• Re: Conditional Expression

Hi Anna,

You can make it more simpler,

=if(GetFieldSelections(Account_Name1,',')='ABC'&','&'BCD',1,0)

Cheers,

Naresh