# Creating fields and metrics

> Custom fields and metrics available through Data Manager in Process Mining for Automation Suite, used to add business logic not available in default app data.

If you want to add business logic to your process app but the field or metric you want to use is not available by default, you can create new data that you can use in your dashboards. This ensures that your dashboards provide the most valuable insights for stakeholders accross the busssiness.

Follow these steps.

1. In the **Data Manager** panel, select **+New**, then select **New field** or **New metric** from the menu. The **Create field** or **Create metric** panel is displayed.
2. Enter a descriptive name for the new field or metric.
   :::tip
   It is a good practice to refer to the goal of the field or metric, which means an indication of what is computed. For example, `Total_cost`, for a field that which multiplies `Quantity` with `Price_per_item` for each order. (`Total_cost = Quantity * Price_per_item`).
   :::
3. If you create a new field, select the table into which you want to create the new field from the available tables in the **Target table** list.
   :::important
   A value is computed for each row of the selected table. References to fields in other tables are computed relative to the selected table. This means that referring to fields in other tables may yield duplicate results. You can only refer to fields which are reachable from the selected table. For example, you can use fields from the `Cases` table when defining a new field in the `Events` table, but not vice versa. The value of a field in `Cases` table is the same (duplicated) for each row in the `Events` table that belongs to the same case.
   :::
4. Configure the business logic in the **Logic configuration** editor using the available logic blocks.
   1. Add the logic block for the operations.
   2. Add the fields and constants to define the operations.
      :::tip
      You can select the **Preview** button to view a sample of the values resulting from the calculation.
      :::
5. Select **Save**.
   :::note
   The **Save** button is only enabled if the logic configuration is complete and correct.
   :::

The field or metric is added to the list of fields and metric in the **Data Manager**.

:::tip
You can also create a new field for a specific table in the **Data manager**. Follow these steps to create a new field for a specific table.
1. In Data manager, locate the table into which you want to create the field.
2. Select the ![Menu](https://dev-assets.cms.uipath.com/assets/images/process-mining/process-mining-image-129960-0d9a692d-b3b8346a.webp) icon to open the menu and select + **Create new field**.
The **Create data** window is displayed and the table is selected in the **Tables** field.
:::

## Adding logic blocks to the canvas

You can easily drag and drop logic blocks onto the Logic configuration canvas to build an expression.

When you create a logic flow or a calculation, the inputs and outputs of each logic block must match up correctly in terms of data kind. The expression is validated, and feedback is displayed on the logic block to help you to troubleshoot and correct the calculations as you go.

:::note
You can only save the logic configuration if it has no errors.
:::
:::tip
You can use the context menu to easily clear, cut, copy, or paste the value of a logic block.
:::

### Previewing results

You can open the **Preview** panel to see the results of the calculations. If you select a block, the results for that selection are displayed.
:::note
The subtitle of the **Preview** panel indicates the scope of the preview.
:::

## Drafts

### Saving a logic block or configuration as a draft

You can save a logic block or configuration and reuse it later.

Follow these steps.

1. Select the logic block you want to save as a draft, and drag it to the **Logic blocks** panel. The **Logic blocks** panels shows a **Add block to draft** area.
2. Drop the logic block on the **Add block to draft** area.

The logic block is removed from the canvas and saved as a draft on the **Draft** tab.

### Using a draft

Follow these steps to use a draft in your configuration.

1. Go to the **Draft** tab and locate the logic block you want to use.
2. Drag and drop the logic block to the desired location in your **Logic configuration**.
   :::note
   The draft is no longer available on the **Draft** tab.
   :::

## Removing a logic block

Follow these steps to remove a logic block.

1. Select the logic block you do not want to use anymore, and drag it to the **Logic blocks** panel. The **Logic blocks** panels shows a **Delete block** area.
2. Drop the logic block on the **Delete block** area.

The logic block is removed from the canvas.
