What is NOT_SET?

NOT_SET is a value that applies to scalar values in expressions. Use it to indicate that the value is not defined.  In Architect, scalar values are non-collection values.  For example: in the following string, the returned value is a NOT_SET string:

ToString(NOT_SET)

An undefined string value is not the same as a blank string. If the following expression is evaluated at runtime, the expression returns as false:

ToString(NOT_SET) == ""

NOT_SET values are not allowed in many overloads and functions for parameter values.  In the Expression Help dialog box, function overload parameters indicate whether or not a NOT_SET value is allowed.  Each parameter includes a “NOT_SET Allowed:” entry that indicates if it accepts a NOT_SET parameter of the specified type.  If, at runtime, Architect evaluates a parameter with an invalid NOT_SET value, it invokes an error handler.

Not sure if a value passed in is NOT_SET?

To avoid an error at runtime, check for NOT_SET in expressions. The following example illustrates an expression scenario that will fail at runtime:

Flow.MyInteger is an Integer variable with the value of NOT_SET.  In this case, a flow author has an Update Data action that assigns this expression to another Integer variable.

5+Flow.MyInteger

Because Flow.MyInteger does not have a value assigned, as entered, it asks the call flow runtime to add undefined to 5. Because this expression has no answer, it invokes an error. If the flow author ensured that Flow.MyInteger had a value (for example, a value other than NOT_SET), 5+Flow.MyInteger would run fine. However, if Flow.MyInteger has a NOT_SET value, the flow author should explicitly check for this in the expression and handle it appropriately.

The next example demonstrates how to use NOT_SET in an expression:

In this case, the logic in the addition treats the instance of Flow.MyInteger in a condition of NOT_SET as if it were 0:

5+If(IsSet(Flow.MyInteger),Flow.MyInteger,0)

The expression essentially says, ” Does a value exist in Flow.MyInteger? If so, use it. Otherwise, if no value exists in Flow.MyInteger, use the value of 0.” In this case, the flow author makes a conscious decision about Architect behavior when a value is NOT_SET, and execution will continue.

IsNotSetOrEmpty

IsNotSetOrEmpty is also a helpful runtime function and is similar to IsSet. This function is useful for working with values being NOT_SET or empty, such as a collection. For more information about this function, see the Expression Help.

NOT_SET and collections

Collections are never NOT_SET as a whole. However, a collection can contain NOT_SET items.