Formulas are used in Docuo for multiple purposes. From calculating the value of a field, to determining whether it is visible or not, or whether it should be locked.
Docuo’s formula editor allows you to test a JavaScript formula while it is being edited.
Suppose we have a Commercial Offers category with some price fields that include formulas:
Let’s edit the formula of the total field, which multiplies the price by the units and applies a discount percentage. To do this, select the field details and go to the options tab in the Formula section:
Click on the button on the right to access the formula editor:
To the right of the button bar we see “Test formula”:
In the pop-up side panel, we can test the formula. First we must choose whether we want to test with a new document window, or by choosing an existing document, in which case its data will be loaded.
The green check indicates that the syntax is correct.
The field whose formula is being edited is shown in yellow.
We can then enter test data in the fields used in the formula to check that the calculations are correct.
You can modify the document state to see how the formula would behave in different states.
You can make changes to the JavaScript formula while you have the test panel open. In this case, in order for the changes in the JavaScript code to be applied, you must click the “Execute” button.