Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Multiple IF Statements on Expressions

Hi,

I'm trying to add this definition to an expression. Can someone tell me where I'm making a mistake?

= IF ((SubStringCount(Concat([Purchase Threshold], '|'),'A') AND GetSelectedCount([Purchase Threshold]) <> 0 AND (Commitment_Amount)<=3500, SUM(Commitment_Amount)), IF (SubStringCount(Concat([Purchase Threshold], '|'),'B') AND GetSelectedCount([Purchase Threshold]) <> 0 AND (Commitment_Amount)>3500, SUM(Commitment_Amount)))

5 Replies
sunny_talwar

Couple of things I would change:

=If(

    SubStringCount(Concat(DISTINCT [Purchase Threshold], '|'),'A') = 1 and

    GetSelectedCount([Purchase Threshold]) <> 0 and

    Commitment_Amount <= 3500, SUM(Commitment_Amount),

If(

    SubStringCount(Concat(DISTINCT [Purchase Threshold], '|'),'B') = 1 and

    GetSelectedCount([Purchase Threshold]) <> 0 and

    Commitment_Amount > 3500, Sum(Commitment_Amount)

  )

  )

Not applicable
Author

Thanks, Sunny. One more question.

If I want to say If (the option selected in my listbox is 'A'), how would I write that?

If (GetSelected ([Purchase Threshold]) = 'A')


Is this right?

sunny_talwar

You can use GetFieldSelections() function:

GetFieldSelections([Purchase Threshold])

Not applicable
Author

Thanks so much.

OK now I have this. Where am I making a mistake again?

=If(

         GetFieldSelections([Purchase Threshold]) = ‘Micropurchase (<=$3500)’ and

     Commitment_Amount <= 3500, SUM(Commitment_Amount),

If(

     GetFieldSelections([Purchase Threshold]) = ‘Simplified (>$3500)’  and

     Commitment_Amount > 3500, Sum(Commitment_Amount)

   )

   )

Not applicable
Author

If you have more than one value selected in a field   GetFieldSelections() will return each values separated by a comma.

Capture.PNG

I think your expression may be wrong for the data you have selected. If you could attach an example