Skip to content

Else if then end

Description

For conditionally executing statements.

Syntax

If <Expression> then 
    <Statements> 
Else If <Expression> Then
    <Statements>
End

Sample

if ({OrderHeader.Order_Total} > {Customer.Order_Limit}) then
    return '!'
else if ({OrderHeader.Order_Total} < {Customer.Order_Limit}) then
    return '[x]' // (U+2713)
end

The result in this example is an exclamation mark ('!') when the Total order amount is higher than the order limit of the customer. Otherwise, the result is a check-mark (✓).

let iRed = rgb(255,0,0)
let iGreen = rgb(0,255,0)
let iBlack = rgb(0,0,0)

if ({OrderHeader.Order_Total} > 0) then
    return iGreen
else
    return iRed
end

For RGB color-codes, constants drRed, drGreen, and drBlack can be used.

if {Customer.State} = "DC" then
    return "Federal district"
else if {Customer.State} = "HI" or {Customer.State} = "AK" then
    return "Outer state"
else 
    return "State"
end