A Rule governs how an output in Q, such as a chart or table, appears. The simplest rules are essentially identical to Conditional Formatting in Excel. For example, the chart below shades the bars proportional to the values.
Rules can also be used to manipulate the contents of outputs. In Example 2 the sample size is inserted into each column heading. In Example 3, a traditional table has been over-written with results from a special form of regression, Shapley Driver Analysis.
- 1 Example 1: Conditional formatting of a bar chart
- 2 Example 2: Adding sample sizes to column headings
- 3 Example 3: Shapley regression
- 4 Alternative ways of applying rules
- 5 Editing, Deleting and Reapplying Rules
Example 1: Conditional formatting of a bar chart
This example is created using Automate > Color Scale and modifying the color options (on the Rules tab, beneath the table).
Example 2: Adding sample sizes to column headings
This example uses Automate > Browse Online Library > Modifying Headers - Adding Sample Size to the Column Labels.
Example 3: Shapley regression
This example uses Regression - Driver (Importance) Analysis - Shapley, whereby a rule is added via QScript.
Alternative ways of applying rules
Highlight cells rules
By selecting Automate > Highlight Cells Rules you can create rules about how to color cells based on the range of values in the cells.
By selecting Automate > Top/Bottom Rules you can create rules about whether to select higher or lower valued cells (e.g., top 10%, below average).
By selecting Automate > Color Scale you can shade cells according to their values (i.e., creating heat maps).
By selecting Automate > Color Scale you can create a Grid of Bars Plot, such as in the first example above.
Custom rules have been created by Q staff to address a variety of common issues (e.g., adding sample sizes to column labels, changing the appearance of small values on tables). You can access custom rules by selecting Automate > Browse Online Library. See Rule Online Library for more information. You can also copy these rules end edit them to suit your needs.
Rules can also be applied using QScript. For example, the QScript called Regression - Driver (Importance) Analysis - Shapley in the Online Library creates new variables, a new table, and applies a custom rule to that table.
Editing, Deleting and Reapplying Rules
When a rule has been added to an output, a new tab will appear at the bottom left of the output called Rules. You can modify rules by clicking on the relevant rule and selecting Edit Rule or Delete Rule.
You can also search for where rules are used by pressing the magnifying glass, as well as apply them to other outputs (using the Apply button at the end of each row).