Formula Editor: General Information
The formula editor is a control that gives a user the abilityto select or compose a formula.
Learning Objectives
In this chapter, you will learn the following about the formula editor:
- The design guidelines for the formula editor, including the naming conventions and layout recommendations
- The proper configuration of the formula editor for specific cases, such as custom options in the Formula Editor dialog box
Applicable Scenarios
You configure the formula editor in the following cases:
- You need to give users the ability to select an existing formula from a combo box
- You need to give users the ability to compose custom formulas
Overview of the Formula Editor
The formula editor control replaces the following controls from the Classic UI:
- CTFormulaInvoiceEditor
- CTFormulaTransactionEditor
- RMFormulaEditor
- PMFormulaEditor
- PXFormulaEditor
- PXFormulaCombo
The formula editor control is composed of the following components:
- A formula box: A box where the formula is displayed. The formula box can be added
as a column or as a box in a fieldset.
The control is implemented with the qp-formula-editor tag. The following screenshot shows an example of formula boxes.
Figure 1. Formula boxes
In the following screenshot, you can see an example of a formula box in a column.
Figure 2. A formula box in a column
You can also configure the formula editor control to be displayed as a combo box, as shown in the following screenshot. For details, see Formula Editor: Configuration of a Combo Box Field for the Formula Editor.
- A Formula Editor dialog box: A dialog box where a user can compose a formula. The
dialog box (see the following screenshot) opens when a user clicks the Edit button in a
formula box.
Figure 3. The Formula Editor dialog box
The control is implemented with the qp-formula-dialog tag. However, you do not need to add this tag to the HTML template; the dialog box is displayed by default.
You can configure the formula box and Formula Editor dialog box in the following locations:
- In the DAC field attributes—specifically, by using the
PXFormulaEditor attribute.Note:We recommend that you configure the control by using DAC field attributes. For details, see Configuration Guidelines.
- In TypeScript, in the columnConfig or fieldConfig decorator.
- In HTML template, in the config attributes.
If you did not use the PXFormulaEditor attribute on a DAC field, to add the formula editor (both the formula box and the Formula Editor dialog box), in the view definition in TypeScript, specify the type of the control as follows:
- In case the control is a fieldset, in the fieldConfig decorator,
specify
control-type="qp-formula-editor"
. - In case the control is in a table, in the columnConfig decorator,
specify
editor-type="qp-formula-editor"
.
If you have used the PXFormulaEditor attribute, you do not need to specify the control type anywhere. It will be determined automatically.