SETVARIABLE( $$Variable, value )
Argument
| Required/
Optional
| Description
|
---|---|---|
$$
Variable
| Required
| Name of the in-out parameter you want to set. Use with in-out parameters configured with the Max or Min aggregation type.
|
value
| Required
| The value to set as the current value of the in-out parameter. You can use a valid expression that evaluates to a datatype compatible with the datatype of the parameter.
|
SETVARIABLE ($$Time, SYSDATE)
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SETVARIABLE ($$Time, TIMESTAMP)
|
|
|
|
---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
What is the point of setvariable and setmaxvariable if they do they work exactly the same?
Hi Tim,
They are actually different. SETMAXVARIABLE sets the current value of an in-out parameter to the higher of the current value of the parameter or the value you specify - so if the current value is higher, it returns the current value, but if the value you specify is higher, it returns the value you specify. SETVARIABLE sets the current value of an in-out parameter to a value you specify.
I'm here to echo Tim Shannon's question: the documentation for both SetVariable and SetMaxVariable indicate that they accomplish the same thing, with the exception that SetVariable can do what both SetMaxVariable and SetMinVariable do. I'm facing an issue where I need the in-out parameter to be not constrained by the aggregation type set in the settings, but it looks like that overwrites everything. I want to save whatever the value of SetVariable produces in the expression, but at the end of the mapping task, all signs point to the aggregation type on the in-out parameter trumping the SetVariable value, should it fall not in the min/max of the aggregation type. How can I just set the variable using the SetVariable function, ignoring the aggregation type? Seems redundant that you have functions for it, but SetVariable + the aggregation type accomplishes the same purpose.
Hi Kip,
Thanks for reaching out. We're currently checking with our development team on this and will get back to you shortly.
Hi Kip,
We received the following answer from our development and QA team:
"The SETVARIABLE function accepts two parameters – value and aggregation. There is no other way to use this function. For the use case you mentioned, you should choose the count aggregation method, but note that count only works with numeric values. Count doesn’t work with timestamp or string values and will throw an error.
With a numeric value, the value must be positive. If a negative numeric value is passed when you use count, this will also throw an error."
If you need further help with your particular use case, please reach out to Informatica Global Customer Support.
Since there seems to be some confusion regarding the difference between the SETVARIABLE and SETMAXVARIABLE functions, we'll also add an example to the documentation in an upcoming release.
Thanks again for your query!