Conditional Styles using Predicates
Summary
- Most Format Column Style Conditions use a Predicate
- This is evaluated by AdapTableQL - AdapTable's Query Language
- A Format Column Condition can contain multiple Predicates if required
- Conditions can use a Referenced Predicate - with different styled and evaluated Columns
Predicates are the most common use case for setting a Format Column Condition.
Standard Predicate Conditions
Predicates are easy to use to AdapTable and can be created visually at run-time through a wizard.
Predicates are ideal when the evaluation requires a single column or a single operation.
For example Price is Positive, Country is NonBlank, Amount is GreaterThan 20 etc.
Find Out More
See full explanations of how Predicates work in AdapTable in the AdapTableQL Predicates Guide
- This demo shows 3 Format Columns using Conditions with Predicates:
Issue ChangeColumn displays green font where value ispositiveIssue ChangeColumn displays red font where value isnegative- Any string column will show as Bold and Upper case if the value includes '.js'
Multiple Predicate Conditions
Prior to Version 14 only a single Predicate could be supplied for each Format Column Condition.
There is now no limit on how many Predicates can be provided in each AlertRule.
This allows for a more powerful and flexibile rules to be set.
Hint
It allows users to use Predicates in preference to more complicated (and sometimes off-putting) Expressions
- This demo shows a Format Column Condition (Bold and Upper) with Multiple Predicates:
- the
Containspredicate with an input of "js" - the
NotInpredicate with an input of "cyclejs"
- the
Expand to see the Format Column Definition with Multiple Predicates
Referenced Predicate Conditions
Typically the Column defined in the Scope will be the one that is evaluated by the Predicate.
However this can be changed so there are separate Scopes for Column and Predicate.
This allows you, for example, to bold ColumnA values when the data in ColumnB meets the Rule in the Predicate.
Hint
- This is useful if the column being evaluated is hidden or only accessible by scrolling, so a visible column is styled
- Or if you want to style the first column in the Row and pin it
This is achieved by:
- setting the Format Column Scope to be the Column which will be rendered
- adding a
ColumnIdto the Predicate defined in the Format Column which will be the column evaluated
Note
This ColumnId property in the Predicate is optional; if not supplied, the Format Column Scope is used
- This example shows how to use a Referenced Predicate:
- the Predicate Scope is
Github Watchersand the Rule isGreaterThan3300 - the Format Column Scope is
Name(which is also pinned) and that Column displayed the Format Column Style
- the Predicate Scope is
- Note: This could also have been achieved by using an Expression of
[github_watchers] > 3300and the same Format Column Scope
Expand to see the Format Column Definition with a Referenced Predicate
Custom Predicate Conditions
Format Column Conditions can also use Custom Predicates.
These are bespoke Predicates defined by developers at design-time and then available for use in AdapTable.
- This demo creates 3 Custom Predicate Definitions and attaches a Format Column Condition to each:
PopularonGithub StarsColumn with Format of Bold Font on Blue BackgroundVanillaonLanguageColumn with Format of Yellow Font on Brown BackgroundLong StringonDescriptionColumn (using Input of 40) with Format of Italics and Purple Border
Find Out More
See Guide to Creating Custom Predicates in AdapTableQL for more information