IF Operator

Allows you to include content based on the result of a comparison between two values.

Syntax:

<if operator="equal,less,less_or_equal,greater,greater_or_equal,not_equal">
<left_term></left_term>
<right_term></right_term>
<true></true>
<false></false>
</if>

Where:

  • equal,less,less_or_equal,greater,greater_or_equal,not_equal determines the way in which left_term and right_term are to be compared.
  • The value in true is the content to be displayed when the result of the comparison is true.
  • The value in false is the content to be displayed when the result of the comparison is false.

Sample Code

If you want to display content when a particular field has a particular value, you can use something like this:

<if operator="equal">
<left_term><field name="IsWon"/></left_term>
<right_term>true</right_term>
<true>We won the Contract.</true>
<false>We did not win the contract.</false>
</if>

In this example, object_Name__c is Opportunity.

If you want to examine whether one value is greater than another and display content based on the result of the comparison, you can use something like this:

<if operator="greater">
<left_term><aggregated_output_list object="Opportunity" relation="AccountId" group_by="">
<aol_field name="Amount" alias="tot" aggregate_function="sum"/>
</aggregated_output_list></left_term>
<right_term>1000000</right_term>
<true>Amount is Greater than 1000000.</true>
<false>Amount is NOT Greater than 1000000.</false>
</if>