Formatting Rule
- Pawel Furmanowski
- Zoe Baldwin
- Anthony George
This page is for data modellers or application developers who want to apply special formatting to data that meets specific criteria.
Overview
A formatting rule allows you to specify an expression which evaluated can apply the selected style to the parent object. It allows to apply styles conditionally, depending on current values displayed on the screen; see Applying Formatting Rules for some examples.
A formatting rule can be applied to a view attribute or to a component. If you apply a formatting rule to a template component, all components created from the template will have a copy of the formatting rule applied.
Property Pane Toolbar
For information about the toolbar options, see the Common Properties page, Toolbars and Controls section.
Properties Tab
Parent Details
If this item is within or belongs to another, its parent name is shown here. See the Parent Details section on the Common Properties page for more details.
Basic Settings
Field | Description |
---|---|
Rule Expression | Expression to be evaluated on order to determine should the Style be applied. This expression takes PhixFlow Internal Variables. See examples below. For more help on expressions, see Regular Expressions and Expressions and PhixScripts. |
Style | Style to be applied when the Rule Expression evaluates to true. |
Order | Order of the Rule Expression. |
Enabled | Flag showing is the Rule Expression enabled. |
Stop If True | Flag showing if the subsequent rules shouldn't be evaluated if the current Rule returns true. |
Audit Tab
Audit Summary
See the Common Properties page, Audit Summary section.
Example
For the Status Type
attribute in a view, set the properties to:
Properties
For the Status Type
attribute in a view, set the properties to:
- Rule Expression:
- either
_field.value == "OK"
- or
_current.StatusSummary=="Validation Passed"
- either
- Style:
BackgroundColour-LightGreen
- Enabled: Tick
_field.value == "OK"
identifies the status type of OK and highlights the cell
identifies the status summary of Validation Passed and then highlights the corresponding status type cell._current.StatusSummary=="Validation Passed"
Resulting View
This displays the OK
field with a green background.
Formatting Rule Expressions
Variables
In formatting rules, you can use the following Internal Variables.
- To determine the maximised state of a screen, use _screen. In a formatting rule, use the state of this variable to set the button icon. This means the button can match the current maximised state of the screen.
- To act on a specific record use one of the following:
Formatting expression variable | Where can the variable be used? | ||||
---|---|---|---|---|---|
Description | View | Form | Card | Form Fields | |
Acts on the record | Provides access to the data currently displayed on the form. e.g. _form.MyAttribute | n/a | Yes | Yes | Yes |
Acts on the record(s) | References the record currently selected on a grid. e.g. _grid.MyColumn | Yes, can be used in actions to get details of the selected record. | Yes, can be used to reference a selected grid item. | Yes, can be used to reference a selected grid item. | Yes, can be used to reference a selected grid item. |
Acts on the record(s) | use _current in expressions for the CSS Properties of grid rows or cards. e.g. _current.AnyColumn | currently displayed in the grid | n/a | currently displayed in the card | n/a |
Acts on the record | The currently selected item, i.e. The selected record or card. e.g. _selected.AnyField | n/a | Currently selected field | Currently selected card or field on the card. | n/a |
The value held in the form field. | The value held in the form field. e.g. if _field.value > 100 | n/a | Access the value in the field | Access the value in the field | n/a |
Available in PhixFlow 11.1.1+ | The details of the current logged in user. e.g. _user.jsmith | Yes | Yes | Yes | Yes |
Functions
For quick changes to screen appearance, you want formatting rules to be evaluated quickly. To ensure a quick response, only use the attribute functions that are evaluated by the client rather than the server; see the list of Responsive Attribute Functions.
Learn More
- Applying Formatting Rules
- Making Template Components
- Screen Structure
- Sizing and Positioning Screen Content
- Style
- CSS Properties
For links to all pages in this topic, see Designing Screens.