You can use an expression to modify the value. In the expression, use source fields, target fields, or mapping variables as variables.
As a variable in the expression, you can use a:

  • Field from any record of the applicable document. If you use a field from another record than the current record, make sure this record is mapped before the current record.
  • Mapping variable that is defined for the message.

Examples:

You can use an expression to:

  • Combine two fields. You can, for example, make a contact location name specific by combining it with the purpose. The expression can be: Description+'-'+Purpose. This results in, for example: Shop Main Street-Financial.
  • Calculate the unit price based on the quantity and line amount on a purchase order confirmation. The variables are from the source record: Qty (PurchLine, PurchQty field) and Amount (PurchLine, LineAmount field). The expression is: Amount/Qty.

Note: 

  • Usually, you use string and real values as variables.
  • Date calculations are not supported.
For more information on expressions, refer to: Expression.


Standard procedure

1. Click Connectivity studio Integration Design.
2. On the Message tab, in the list, find and select the desired message.
3. Click Edit.
4. In the Mapping section, in the Target record pane, in the list, find and select the desired target record.
5. On the Mapping tab, on the Field mapping tab, in the list, find and select the desired field mapping.
6. Click the Field options tab.
7. Select the Custom check box.
8. Add a variable line for each variable that is used in the expression.
  In the Variables pane, click New.
9. In the Variable field, type exactly the variable name as used in the expression.
10. Define if the variable is linked to a field in the source document or target document.
  In the Record origin field, select an option.
11. Define the document record to which the variable is linked.
  In the Record field, enter or select a value.
12. Define the document record field to which the variable is linked.
  In the Record field field, enter or select a value.
 

Note: The field type, as defined for the document record field, is shown as well.

13. During a message run, you can use mapping variables to temporary store values. You can write (calculated) values to a mapping variable. Later, during the same message run, you read the value from the mapping variable for use in a custom expression.
  In the Mapping variable field, enter or select the mapping variable which value is used in the expression.
 

Note: Make sure, the field mapping in which the mapping variable is written, is done before the field mapping for which you define the custom expression.

14. You can indicate how the variable value must be handled in the expression, regardless of the document record field type.
  In the Variable type field, select an option.
15. You can define the language in which the variable is expressed.
  In the Language field, enter or select a value.
16. In the Expression field, enter the expression, using variables.
17. Before the output value of the custom option is determined, you can apply a type conversion to the value that is returned by the custom expression.
  In the Type conversions field, enter or select a value.
 

Note: You can test the created expression. To do so, click test expression. On the dialog, fill in the values of the variables and click Execute.

18. Close the page.

Notes

Applying expression conditions can influence the message performance. So, only apply an expression condition if required and keep it as simple as possible.


An example of a more complex custom expression. Based on the values of the 'netPrice' from the source record and the 'taxPerc' from the target record, the tax amount is calculated.

Provide feedback