Handling null

This section describes expression handling of a “null” input from a linked status type output.
Figure 61.   The result of a math expression with any null (or nan) input can be nan
Image

In a math expression, if a Double or Float input slot is linked to a source StatusNumeric output with a “null” value, the input is evaluated as “nan” (not a number). If the expression has a Double or Float slot as output, the result is also nan, as shown. This also occurs if such an input has a nan.

Note if the input slot is an Integer or Long type, the expression ignores the null value—the last valid value is used (or if nan input, is processed as value 0). The output is some number. If an input slot is a StatusNumeric (requires expression syntax inputSlotName.value), a null input is seen but not processed.

In a logic expression, if a Boolean input slot is linked to a source BooleanNumeric output with a “null” value, the null is ignored by the expression—the last valid value is used. If the input slot is a StatusBoolean type (again, syntax inputSlotName.value is required), the null is seen but not processed.

The Expr component utilizes the automatic “conversion links” feature introduced in AX-3.6, such that “link from” behavior between dissimilar data types is followed. For more information, see Conversion Links.

In general, if creating an Expr component for use in control logic that may have one or more “null” inputs, it is recommended that you test it to verify the desired behavior.

 NOTE: Starting in AX-3.6, changes were also made to the various “status value to simple value” kitControl Conversion components, to allow the option of specifying an output value when the status input is null. If needed, you may wish to use one or more of these components “upstream” of the Expr component. For more details, refer to the NiagaraAX KitControl Guide section “Status value to simple value”.