Conditional  Statements

The following Conditional  Statements are supported by the Formula field on the Configurable Formula page.

Operator

Description

If

Use classic if/else statement.

Example:

To evaluate a field value conditionally comparing another field value.

if (RATING > 30){

   ‘High Rating’;

}else if (RATING > 20){

   ‘Medium Rating’;

}else{

   ‘Low Rating’;

}

RATING in above scenario is a field on the referenced business object.

for

Use classic for statement to loop through items of a Collection (Array, Map, Iterator or Enumerator).

Example:

To sum a field value on parent table using a child collection:

var sum = 0.00;

for (ChildClass child : this.getChildren(){

     sum =  sum + child.getAMOUNT()     

}

return sum

In the above scenario, getChildren() is an existing JAVA method on the referenced business object and returns an array of child objects.

Note: getChildren() is not accessible for Performance Budgeting.

while

Use the classic while statement to loop through items of a Collection until a condition is satisfied (Array, Map, Iterator or Enumerator).

Example:

To evaluate a field value on a transaction header component looping through commodity records:

var commodities = this.getCommodityLines();

while (commodities.hasMoreElements()){

     if (StringUtils.isNotEmpty(commodities.getCOMM_TYP())

            &&   StringUtils.equals(

                    commodities.getCOMM_TYP(),’SPECIAL’)){

        return true;

     }

}

In the above scenario, getCommdityLines() is an existing JAVA method on the referenced business object.

Note: getCommdityLines() method is not accessible for Performance Budgeting.

continue

Skips to the next iteration within loops.

break

Breaks from a loop.