Function Reference > Functions > %OPR_IIF%
  

%OPR_IIF%

Uses the IIF function and expands an expression in an expression macro to evaluate a set of IIF statements.

Syntax

%OPR_IIF[ condition, macro_input_field [,value ]]%
The following table describes the arguments for this function:
Argument
Required/
Optional
Description
condition
Required
The condition you want to evaluate. You can enter any valid expression that evaluates to TRUE or FALSE. You can enter a macro input field or an expression that includes at least one macro input field.
macro_input_field
Required
The values you want to return if the condition is TRUE. Any data type except Binary. The return value is the data type specified by this argument. You can enter a macro input field or an expression that includes at least one macro input field.
value
Optional
The value you want to return if the condition is FALSE. Any data type except Binary. In a horizontal or vertical macro, you can enter any valid expression. In a hybrid macro, enter the input macro field that is used to define the output macro field.
Unlike conditional functions in some systems, the FALSE (value) condition in the %OPR_IIF% function is not required. If you omit value, the function returns the following values when the condition is FALSE:

Return Value

macro_input_field if the condition is TRUE.
value if the condition is FALSE.
If the data contains multibyte characters and the condition argument compares string data, the return value depends on the code page of the Secure Agent that runs the task.

%OPR_IIF% and Data types

When you use %OPR_IIF%, the data type of the return value is the same as the data type of the result with the greatest precision.
When at least one result is Double, the data type of the return value is Double.

Example

The following macro input fields %tmin% and %tmax% create ranges that correspond to the following %type% macro input field:
%tmin%
%tmax%
%type%
0
30
very cold
31
60
cold
61
90
warm
91
100
hot
101
150
very hot
The following expression assigns a type based on the temperature data:
%OPR_IIF [ (TEMP >= %tmin%) AND (TEMP <= %tmax%), '%type%', 'out of range' ]%
%OPR_IIF% evaluates the following temperatures and returns a type:
TEMP
RETURN VALUE
79
warm
21
very cold
170
out of range
99
hot
90
warm