Numeric Calculations In Process Fields

Problem

GlobalCapture can perform addition and subtraction functions on numeric process fields.  This functionality can be useful when working though lists or tables of data.  When using notation, the data type of the process fields in the notation will impact the entire expression.  If for example you use a notation that includes both numeric and character process fields, the entire expression will be treated as a numeric expression and math will be performed.

Consider the following expression:

{p_MVChar[p_CharIndex]}

This expression involves two process fields (MVChar and CharIndex).  MVChar is a multi-value field, which some might call an array.  The common method for accessing items in this type of list would be the reference a specific item in the list by providing its index in square brackets.  So in the example, CharIndex represents some numeric index value, and in this expression the value returned would be the value at CharIndex's position in the list.  If CharIndex's data type is numeric, which normally makes sense so it value might be incremented at a different step in the workflow, the entire expression is evaluated as a numeric.  This means any data in MVChar that is numeric, will be considered numeric a math may be performed.  If MVChar contains a SSN (111-11-1111), the inferred data type and it's preference to perform math will lead to undesirable results.

Solution

It's important to understand when and how GlobalCapture will perform math functions on data, and how data in a field will be processed to ensure expected results.  The presence of a "+" or a "-" in the Value of a Set Process Field node will only operate as a mathematical function if the data type of the field is correct.  When using a character field, these characters will be treated as literal values versus an expression.  This is true even when working with lists and counter fields to control elements in the list.  If you don't want math to be performed in expressions, be sure all data types in the expression are of type Character.  You may need to create a new process field of type Character and sets it value to the value of the current Numeric index value before the primary expression is evaluated.