Description
This function is similar to the SETNAMEDVALUE function, which returns a name/value pair that is saved across source rows. However, the SETNAMEDVALUEIF function returns the value only if the passed condition is true.
Syntax
SETNAMEDVALUEIF ( name, condition, value )
Parameter | Description |
---|---|
name | String that identifies the value. This allows multiple values to be stored at once, each with a different name. Not case-sensitive. |
condition | The condition to be tested. The condition can be a source field or a user variable. The value is set only if the condition is true. |
value | The value to store. |
Remarks
If the passed condition is true, the function stores and returns the name/value pair. The value persists across source rows, until it is changed by another call to the function.
The value can be retrieved at any time using the GETNAMEDVALUE function.
These values are cleared before each job runs so values stored for one job are not available for another.
Examples
When the source field Market (source reference number S4) is "US", the following function sets the value of "Category" to "Domestic":
SETNAMEDVALUEIF( "CATEGORY", S4="US", "DOMESTIC" )
The following example illustrates using the function for several name/value pairs.
SETNAMEDVALUE( "USCurrency", S4="US", "DOLLAR" )
SETNAMEDVALUE( "EuropeanCurrency", S4="EURO", "EURO" )
SETNAMEDVALUE( "AsianCurrency", S4="ASIA", "HKD" )
These values persist across rows until another call to the function changes the name/value pairs.
See also