Views: 3746
Last Modified: 01.09.2021

Example of calculating numerical values

Let's overview an example of handling element fields with calculation of values The system can calculate expression values in action parameters. . For simplicity, use the list feature (Services > Lists). Actions described below are applicable to other elements as well, for example, CRM. Basis for the example is a hypothetical forum message:

"Hello, i've encountered with the following issue: My deal must calculate a net profit from stipulated deal total, with substracted 6% tax as well as contract expenses (if available). The result is logged into the manager report for the successful deal."

Sequence of actions

  • Create a new list, with set of fields number Note: depending on PHP settings, number field values can be displayed using Scientific notation. :

    • Total;
    • Contact expenses Contract expenses field is optional. When it contains values, they will be included into the calculations. ;
    • Tax (6%). Calculated automatically;
    • Total. Calculated automatically .
  • Create a sequential workflow template and configure it for launch upon adding a new element.
  • Add and configure the first action as Edit, calculating tax on total :

    Field: Tax (6%). Calculated automatically,

    Value: ={=Document:PROPERTY_s}*0.06,

    where {=Document:PROPERTY_s} is the Total field value.

  • Add and configure the second action Edit, that will calculate the total with account of all substractions:

    Field: Total. Calculated automatically,

    Value: ={=Document:PROPERTY_s}-{=Document:PROPERTY_contract}-{=Document:PROPERTY_tax},


    {=Document:PROPERTY_s} - Total field value,
    {=Document:PROPERTY_contract} - Contact expenses field value,
    {=Document:PROPERTY_tax} - Tax (6%) field value. Calculated automatically.


Courses developed by Bitrix24