36
Views
4
Comments
Solved
how to apply condition in expression widget?
Question

hy All,

can anybody tell me i have three static entity value(approved=1,pending=2,declined=3) how to apply condition in expression widget that we can find data for approved=1 and for others(pending,declined)

thank you in advance.

mvp_badge
MVP
Rank: #89

Hi Rohan,

You can use the inline-IF statement

Syntax:

If(ConditionSection, trueSection, falseSection)


In your case you will have to do define something as mentioned below

If(OrderStatus = 1, "Order Approved", if(OrderStatus = 2, "Order Pending", "Order Declined"))


To be more precise in the logic (avoid hard-coded status values in the conditional statements instead refer the Static Entity Record Id value)

If(OrderStatus = Entities.OrderStatus.Approved, "Order Approved", if(OrderStatus =  Entities.OrderStatus.Pending, "Order Pending", "Order Declined"))


Hope this helps you!


Regards,

Benjith Sam

Rank: #135

Hi Rohan,


what Benjit replied is the correct answer to your question.


But if you have a static entity, you should not hardcode stuff inside expressions.  If a value (such as the text to display for a given status, depends on the chosen record from the static entity, please have this textual value as a attribute on your static entity, and just display that in your expression.

Dorine

Rank: #4321

hy ,

one more thing i missed in my question i have to count them differently

Rank: #90
Solution