Modify Headers - Automatically Remove NETs from Table
Jump to navigation
Jump to search
Q Technical Reference
Q Technical Reference
Q Technical Reference > Creating And Modifying Tables
Q Technical Reference > Setting Up Data > Creating New Variables
Q Technical Reference > Updating and Automation > Automation Online Library
Q Technical Reference > Updating and Automation > JavaScript > Table JavaScript and Plot JavaScript
Rule Online Library
This rule hides NET columns and NET rows on tables. Note that there are other tools available in Q for doing the same thing but in a more transparent way:
- You can right-click on a category on a table and select Hide.
- When exporting to Office there is an option called Ignore NET and SUM.
- On Charts there is an option called Show NETs/SUMs.
Example
How to apply this rule
For the first time in a project
- Select the table(s)/chart(s) that you wish to apply the rule to.
- Start typing the name of the Rule into the Search features and data box in the top right of the Q window.
- Click on the Rule when it appears in the QScripts and Rules section of the search results.
OR
- Select Automate > Browse Online Library.
- Choose this rule from the list.
Additional applications of the rule
- Select a table or chart that has the rule and any table(s)/chart(s) that you wish to apply the rule to.
- Click on the Rules tab (bottom-left of the table/chart).
- Select the rule that you wish to apply.
- Click on the Apply drop-down and choose your desired option.
- Check New items to have it automatically applied to new items that you create. Use Edit > Project Options > Save as Template to create a new project template that automatically uses this rule.
Removing the rule
- Select the table(s)/chart(s) that you wish to remove the rule from.
- Press the Rules tab (bottom-right corner).
- Press Apply next to the rule you wish to remove and choose the appropriate option.
How to modify the rule
- Click on the Rules tab (bottom-left of the table/chart).
- Select the rule that you wish to modify.
- Click Edit Rule and make the desired changes. Alternatively, you can use the JavaScript below to make your own rule (see Customizing Rules).
JavaScript
includeWeb("Table JavaScript Utility Functions");
form.setHeading("Automatically Remove NETs From Table");
form.setSummary("Automatically remove NETs from table");
let description = form.newLabel("Automatically removes the original table NET row and column");
description.lineBreakAfter = true;
form.setInputControls([description]);
// Delete any NET columns
table.netColumns.forEach(function (net_col, index) {
deleteColumnComplete(net_col - index);
});
// Delete any NET rows
table.netRows.forEach(function (net_row, index) {
deleteRowComplete(net_row - index);
});
See also
- User Input for Rules for technical information on Rules.
- Rule Online Library for other examples of Rules.
- Table JavaScript and Plot JavaScript for the JavaScript that is used to write custom rules.
- JavaScript for information about the JavaScript programming language.
Q Technical Reference
Q Technical Reference
Q Technical Reference > Creating And Modifying Tables
Q Technical Reference > Setting Up Data > Creating New Variables
Q Technical Reference > Updating and Automation > Automation Online Library
Q Technical Reference > Updating and Automation > JavaScript > Table JavaScript and Plot JavaScript
Rule Online Library