Is There a Limit to Lightning Formula Parameters?

As I use the client side to enforce various pieces of business logic with aura:if statements, I’m finding that a given formula operator cannot handle more than two parameters.

For example, this works:

<aura:if isTrue="and(v.myAttributeString == 'Open', v.myAttributeBoolean == true)">
    //do some stuff
</aura:if>

But the following does not work (or at least the third “v.myAttributeSecondString” is not evaluated):

<aura:if isTrue="and(v.myAttributeString == 'Open', v.myAttributeBoolean == true, v.myAttributeSecondString == 'Yes')">
    //do some stuff
</aura:if>

Has anyone seen the same effect occur? Any documentation on this? Am I crazy and this actually does work, just not for me?

Thanks!

Answer

Yes, it’s a known bug/limitation of Expression Operators. You can only evaluate two parameters in and and or expressions. You’ll probably want to consider setting an attribute evaluated by your controller to determine the final logic behavior as a workaround.

Attribution
Source : Link , Question Author : techbusinessman , Answer Author : sfdcfox

Leave a Comment