--- title: "Set up enrichment line of type Calculated field" slug: "set-up-enrichment-line-of-type-calculated-field" description: "Learn how to create enrichment rules and set field values using calculated fields, expressions, and manual selection in data quality management." updated: 2026-07-06T13:10:02Z published: 2026-07-06T13:10:02Z canonical: "docs.staedean.com/set-up-enrichment-line-of-type-calculated-field" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.staedean.com/llms.txt > Use this file to discover all available pages before exploring further. # Set up enrichment line of type Calculated field 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 1. Click **Data quality management**. 2. On the **Data quality policies** tab, in the list, click the link of the desired data quality policy. 3. Click the **Enrichment rules** tab. 4. In the enrichment rules list (left pane), find and select the desired enrichment rule. 5. Sub-task: Manually create enrichment line. 1. You can manually create an enrichment line and define its target table and its target field. In the **Enrichment lines** section, click **Add**. 2. 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. 3. Define the target datasource field which value must be set. In the **Target field** field, enter or select a value. > [!NOTE] > **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. 6. Sub-task: Create enrichment lines by selecting fields. 1. You can create enrichment lines by selecting fields from a page. In the **Enrichment lines** section, click **Select** fields. 2. Open the page from which you want to select fields. 3. On the **Field picker** dialog, click **Select** fields. 4. Click the '**+**' button for each field that you want to select. 5. On the **Field picker** dialog, click **Done**. 6. On the **Field picker** dialog, click **Submit** to save the selected fields to the validation rule. 7. In the **Value type** field, select '**Calculated field**'. 8. 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. 9. Set up the calculation expression for the enrichment rule. In the **Details** section, click **Calculation**. 10. Sub-task: Set up variables. 1. In the **Variables** section, click **New**. 2. In the **Name** field, enter a short variable name. 3. 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. 4. 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. 5. In the **Field name** field, select a field. 6. **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. 7. **You can define the language in which the variable is expressed.** In the **Language** field, you can enter a language. 11. Define the calculation expression. For more information on defining an expression, see [Expressions](/data-management/docs/set-up-enrichment-line-of-type-calculated-field#expressions). In the **Expression** field, define the expression, using variables. 12. Sub-task: Test expression. 1. Click **Test expression**. 2. Define test values for each variable. On the **Test expression** page, in the **Variables** section, in the **Value** field, enter a test value. > [!NOTE] > Note > > Usually, you use the default **Variable type** and **Language** as defined in the calculation setup. 3. Click **Execute**. 4. In the **Result** section, review the test result. 5. Close the page. 13. 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](https://learn.microsoft.com/en-us/dotnet/api/system.data.datacolumn.expression?redirectedfrom=MSDN&view=net-5.0#System_Data_DataColumn_Expression). #### 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)