For an enrichment rule, use an enrichment rule line to set a field value. To set a field value, you can use several value types. Use the value type Calculated field to set the value of a target field based on an expression. You can use the expression for numeric calculations or for string-based operations.
You can add enrichment lines in these ways:
Manually.
Select the target fields from a page.
Steps
Click Data quality management.
On the Data quality policies tab, in the list, click the link of the desired data quality policy.
Click the Enrichment rules tab.
In the enrichment rules list (left pane), find and select the desired enrichment rule.
Sub-task: Manually create enrichment line.
You can manually create an enrichment line and define its target table and its target field.
In the Enrichment lines section, click Add.
Define the table to be used as target datasource.
Target datasources can exist, other than the source datasource. If so, you can select the source datasource or one of the other target datasources.
In the Target data source field, enter or select a value.
Define the target datasource field which value must be set.
In the Target field field, enter or select a value.
Note
If the enrichment line is marked as 'key-field' or 'has-relation', the target field is used to define to which target datasource records the enrichment rule applies. In this case, the target field value is not set.
Sub-task: Create enrichment lines by selecting fields.
You can create enrichment lines by selecting fields from a page.
In the Enrichment lines section, click Select fields.
Open the page from which you want to select fields.
On the Field picker dialog, click Select fields.
Click the '+' button for each field that you want to select.
On the Field picker dialog, click Done.
On the Field picker dialog, click Submit to save the selected fields to the validation rule.
In the Value type field, select 'Calculated field'.
You can use manually defined field relations to identify records in the target datasource. The manually defined field relations setup defines to which target datasource records the enrichment rule applies.
You can use manually defined field relations, for example, if no key fields are defined, or if you want to define other field relations than defined by the key fields.
Select the Has relation check box.
Set up the calculation expression for the enrichment rule.
In the Details section, click Calculation.
Sub-task: Set up variables.
In the Variables section, click New.
In the Name field, enter a short variable name.
You can use a field value from a Target table or the Source table as a variable.
In the Data source type field, select an option.If the Data source type is Target table, target tables, other than the source table, can be available.
In the Table name field, select a target table.In the Field name field, select a field.
You can indicate how the variable value must be handled in the expression, regardless of the document record field type. Usually, the default variable type is used.
In the Variable type field, select an option.
You can define the language in which the variable is expressed.
In the Language field, you can enter a language.
Define the calculation expression. For more information on defining an expression, see Expressions.
In the Expression field, define the expression, using variables.Sub-task: Test expression.
Click Test expression.
Define test values for each variable.
On the Test expression page, in the Variables section, in the Value field, enter a test value.Note
Usually, you use the default Variable type and Language as defined in the calculation setup.
Click Execute.
In the Result section, review the test result.
Close the page.
Close the page.
Expressions
In the calculation expression, you can use:
Variables: Add a defined variable by entering the variable Name.
Arithmetic operators: +, -, *, /
String functions like TRIM and SUBSTRING
Fixed values: You can enter a fixed value between single quotation marks. Example: ‘-’.
For more information on expressions, see Expressions.
Expression examples:
Example 1:
Combine the product name and product description in one target field, divided by a hyphen.
Variables:
a - Product name
b - Product description
Expression: a+’-’+b
Example 2:
To add the packaging weight to a target field, you can subtract the net weight from the gross weight.
Variables:
nw - Net weight
gw - Gross weight
Expression: gw-nw
Example 3:
You want to remove all leading and trailing blank characters from customer names in D365 F&SCM.
Variable: c - Customer
Expression: TRIM(c)