Formula builder
In 1C:Drive, the formula builder is a tool used to create formulas for catalog items, reports, documents, and print forms. Formulas define rules for calculating data or displaying custom text strings. For example, you can create a formula for calculating an employee's earning or for displaying an accounting entry description like "Payroll as of <payroll date>".
The steps to open the tool, its look and feel depend on where a formula applies. For the exact instructions, see the documentation on a specific catalog, document, report setting, or print form.
Typically, the formula builder includes the following sections:
| Section | Description | List of possible titles |
|---|---|---|
| Formula text box | This is where you specify a formula. |
|
| Operands list | This is where you select operands to include in a formula. A set of operands depends on where the formula applies. An operand in a formula can be a specific document field to take value from, a calculated parameter that depends on multiple values, or even another formula. For example, a budget item formula can include operands based on other formulas. |
|
| Operators and functions list | This is where you select operators or functions to include in a formula. They indicate arithmetical (like "+", "-" ), logical (like "If...Else"), and other operations (like date format or rounding) that apply to an operand. A set of operators and functions depends on where the formula applies. |
|
In general, in the formula builder, you can create the following types of formulas:
| Formula type | Description | Example |
|---|---|---|
| Arithmetic expression | Combines numbers, operands, and operators (like "+", "-",) to compute a value. | [TariffRate] * [DaysWorked] / [NormDays] Calculates a salary based on a pay rate per hour, number of days an employee worked in a pay period, and total number of working days in that period. |
| Expression for report data field | Similar to an arithmetic expression but the calculations are based on the report data. Such an expression can also include aggregate functions like AVG (average amount) or Min (minimum amount) |
Count (Distinct [Contract]) Counts the number of a counterparty's contracts for which transactions were recorded, where Distinct is added to avoid double-counting of the same contract. |
| String template | Includes free-form text with operands to be replaced with the respective values. | "Invoice as of "+[Document.SalesInvoice.Date] Shows a dynamic description for an accounting entry where: "Invoice as of " is a free-form text [Document.SalesInvoice.Date] is an operand represented by the invoice date field. It is replaced with the invoice date, when the entry is recorded. |
To create a formula:
- In the formula builder, add operands and operators or functions as follows:
- Double-click them (before that, ensure the cursor is placed in the required position in the formula)
or - Drag them to the required position in the formula
In some cases, a search field is available above the list of operands or above the list of operators or functions. To quickly find an item in the list, type the item name in the searсh field and press Enter.Operands, operators, functions can be grouped in the list. To expand a group, click
in the list line.
- Double-click them (before that, ensure the cursor is placed in the required position in the formula)
- Optional: To check the formula syntax, click Check formula.
The syntax check detects only errors like a missing or unnecessary symbol in the formula. For example. a missing round bracket. Issues like a function inapplicability to a certain data type is not checked. For example, if you apply a rounding function to an operand with the "Date format" data type, you might receive an error when a formula is actually applied.The button for checking the formula syntax can have a different name such as Validate formula.
- Click Finish editing to save the formula and close the formula builder.
The button can have a different name such as OK or Select.
Note that the rules of specifying formula vary depending on type of data that the formula processes. For example, text must be enclosed in quotes.