GXYiIIF

Unofficial Content

IIF statement


Scope

Language: Java, .NET, .NET Mobile
Objects: Procedures, Transactions, Work Panels, Web Panels, Reports

Introduction


The iif function evaluates a condition and returns a value if the condition is true or another value if the condition is false. The returned value is stored either in an attribute or variable. The attribute|variable where the returned value is stored and both possible return values (specified for true and false) must have the same type.

Description


Syntax


ret-value = iif(condition, true-return-value, false-return-value)

Type Returned
The same type specified for the possible return values.

Where

Condition:
  Is the condition to be evaluated.

true-return-value
  Is the result to be returned if the condition is true.

false-return-value
  Is the result to be returned if the condition is false.

Example


// &a , &b -> numeric type
// &result  -> character
&a = 5
&b = 5
&result = iif(&a = &b, 'ok' , 'error')


The value of &result will be 'ok' because &a=b (5 = 5).

Comments & Collaboration