# Assign a Value using Mathematical Calculations

TDO can also perform mathematical calculations as part of a data assignment rule.

In the example below, we are calculating a fee based on a payment amount.

The calculation for the rule is 'payment amount x fee percentage' and the output is rounded to 2 digits.  This rule is created by creating a rule container for the 'fee' field, and then opening the 'Compose' window for that rule.  First, the payment amount is assigned to the rule.  Then the Operator of 'Multiply' is selected, and the field 'fee' from the 'fee\_view' is selected.  This is then added (click the plus sign) to the Operands list.

<figure><img src="/files/nufdHIKH87jfYlnfHs2u" alt=""><figcaption><p>Creating a mathematical calculation rule</p></figcaption></figure>

Finally, the Operator 'Round' is selected, an a value of '2' assigned.  ('Round' will round the amount to the right of the decimal point to the number of digits specified.)  The full rule is shown below.

<figure><img src="/files/jMjInuNeaZKbJsDoyZn5" alt=""><figcaption><p>Completed rule for mathematical calculations</p></figcaption></figure>

When assembled, the data output is shown below.

<figure><img src="/files/DsH8MdjML8gNw9tiIr42" alt=""><figcaption><p>Output of calculated field</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.apica.io/platform-docs/test-data-orchestrator-tdo/user-documentation/tdo-project-builder-user-guide/data-assignment/assign-a-value-using-mathematical-calculations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
