The EITHER function returns the result of the first argument that does not evaluate to "none".

EITHER (single-general-expression { , single-general-expression } )
EITHER ( try_this { , if_none_try_this } )
A single object

The EITHER return methods work in the following ways:

try_this does not evaluate to "none"
try_this evaluates to "none"
the next if_none_try_this
the first if_none_try_this evaluates to "none"
Note: The Design Studio compiler does not validate the second argument or subsequent arguments against the type tree.


  • EITHER ( OrderDate Field , CURRENTDATE ( ) )

    If OrderDate Field does not evaluate to "none", it is returned. If OrderDate Field evaluates to "none", the current system date (using CURRENTDATE) is returned.

  • EITHER ( LOOKUP (PriorityCd:Msg , CustID:Msg = "93X" ) , 8 )

    This example returns the result of the LOOKUP if that result does not evaluate to "none"; otherwise, it returns the second argument of 8.

  • EITHER (IF (SomeCode = "C" , CustomerID:Input) ,
    IF (SomeCode = "S" , SupplierID:Input) ,
    IF (SomeCode = "O" , Reference#:Input) ,
    "####" )

    If SomeCode is C and CustomerID:Input has a value, EITHER returns the value of CustomerID. Otherwise, if SomeCode is S and CustomerID:Input has a value, EITHER returns the value of SupplierID. Otherwise, if SomeCode is O and Reference#:Input has a value, EITHER returns the value of Reference#. If none of those conditions result in a value, EITHER returns "####".

  • You can use EITHER when you want a default value when an expression evaluates to "none" and the expression might cause common arguments to produce an unintended result. For example, use:

    EITHER (LOOKUP (PriorityCd:Msg , CustID:Msg = "93X") , 8)

    -instead of-

    IF (PRESENT (LOOKUP (PriorityCd:Msg , CustID:Msg = "93X" ) ),
    LOOKUP ( PriorityCd:Msg , CustID:Msg = "93X" ) , 8 )