Configure Quantiles and Ranges - SuperWEB2
The Range button in SuperWEB2 allows users to create custom ranges:
There are several aspects of this feature that you can configure.
Configure Limits for Ranges
You can set minimum and maximum limits for ranges, as well as a minimum value for the increment. These settings are configured using the ranges
command in SuperADMIN.
The settings apply to both custom ranges and quantiles, although the increment will not apply to quantiles.
For example, to set limits for the Customer Profit field of the Retail Banking database (ID: bank), you could use a command similar to the following:
> ranges bank "Customer Profit" custom 10 10000 100
For more information, see the documentation for the ranges
command.
Configure the Labels for Quantile Ranges
When you create a Quantile Range in SuperWEB2, it displays in the Ranges section of the Customise Table tree. By default, each of the ranges will be labelled as follows:
Values from {Min} to {Max} make up Quantile Range {Num}
Where:
- {Min} is the lower end of the range.
{Max} is the upper end of the range.
- {Num} indicates the number of this range within the quantile, starting from 1.
You can change the label by editing <tomcat_home>\webapps\webapi\WEB-INF\classes\database_labels.properties
There may be multiple copies of this file for different languages and locales, with names like database_labels_en.properties, and database_labels_en_AU.properties. You need to make these changes in all versions of the file. The properties file that is used will depend on the language settings in the end user's web browser and the set of supported locales defined in the faces-config.xml configuration file (see Multilingual and Localisation Support - SuperWEB2 for more information about localisation and how SuperWEB2 uses the properties files).
To modify the label, add a definition similar to the following and change the text:
udf.quantile.range=Values from {Min} to {Max} make up Quantile Range {Num}
By default, the udf.quantile.range does not appear in the database_labels.properties file. It only needs to be added if you want to change the label displayed in SuperWEB2.
Your updated string must contain:
- A single occurrence of {Num} - this will be replaced with the number of the range.
- No more than one occurrence each of {Min} and {Min} - these will be replaced with the upper and lower values of the range.
Your string must not contain any other instances of the characters { or }
Configure the Error Messages for Quantile Ranges
If you attempt to create a quantile range that does not satisfy the configured range limits, SuperWEB2 displays an error message:
You can configure the text of these error messages by editing <tomcat_home>\webapps\webapi\WEB-INF\classes\database_labels.properties
There may be multiple copies of this file for different languages and locales, with names like database_labels_en.properties, and database_labels_en_AU.properties. You need to make these changes in all versions of the file. The properties file that is used will depend on the language settings in the end user's web browser and the set of supported locales defined in the faces-config.xml configuration file (see Multilingual and Localisation Support - SuperWEB2 for more information about localisation and how SuperWEB2 uses the properties files).
To change the error messages, edit the following lines:
ranges.quantile.error.invalidMin= Minimum value allowed is {0}, while minimum calculated value with this configuration is {1}
ranges.quantile.error.invalidMax= Maximum value allowed is {0}, while maximum calculated value with this configuration is {1}
ranges.quantile.error.invalidRanges=Calculated Quantile ranges are not valid:
Remove the Quantile Tab
You can also remove the quantile tab from the Range dialog if you do not want users to be able to create Quantile ranges.
Configure the Field Exclusion Rule for Quantile Ranges
The field exclusion rules for tables allow you to limit the number of fields from a defined group that can be added to the table at any one time. If you have defined field exclusion rules for tables, you can choose whether these rules also apply to the quantile range filter.
Apply the Table Field Exclusion Rules to the Quantile Range Filter
To apply the field exclusion rules from the table to quantile range filters:
- Make sure you have followed the instructions to define and activate your field exclusion rules.
- Open <tomcat_home>\webapps\webapi\WEB-INF\data\.repository\RulesEngine.xml in a text editor.
Make sure that the
<rules:rule-name name="FieldExclusionRule"/>
is specified within theQuantileFilterRules
(and is not commented out):XML<rules:RulesPipe name="QuantileFilterRules"> <rules:rule-name name="FieldExclusionRule"/> </rules:RulesPipe>
- Save your changes to the file (if any) and restart Tomcat or the SuperWEB2 service.
Remove the Table Field Exclusion Rules from the Quantile Range Filter
If you do not want the table field exclusion rules to apply to quantile range filters:
- Open <tomcat_home>\webapps\webapi\WEB-INF\data\.repository\RulesEngine.xml in a text editor.
Comment out the
<rules:rule-name name="FieldExclusionRule"/>
within theQuantileFilterRules
:XML<rules:RulesPipe name="QuantileFilterRules"> <!-- <rules:rule-name name="FieldExclusionRule"/> --> </rules:RulesPipe>
- Save your changes to the file (if any) and restart Tomcat or the SuperWEB2 service.
Apply a Different Set of Field Exclusion Rules to the Quantile Range Filter
If you want to use a different set of rules for the quantile range filter, you need to:
Locate the following section of RulesEngine.xml:
XML<rules:EditRule name="FieldExclusionRule" applicableOperation="add" implClassName="au.com.str.webapi.services.database.manager.rules.impl.FieldExclusionRule"> <rules:impl-class-init> <rules:init-param name="resource" value="fieldExclusionRule"/> </rules:impl-class-init> </rules:EditRule>
Make a copy of this section, renaming the rule (for example to fieldExclusionRule2):
XML<rules:EditRule name="FieldExclusionRule2" applicableOperation="add" implClassName="au.com.str.webapi.services.database.manager.rules.impl.FieldExclusionRule"> <rules:impl-class-init> <rules:init-param name="resource" value="fieldExclusionRule2"/> </rules:impl-class-init> </rules:EditRule>
Update the
QuantileFilterRules
section to refer to your new rule instead:XML<rules:RulesPipe name="QuantileFilterRules"> <rules:rule-name name="FieldExclusionRule2"/> </rules:RulesPipe>
- Create a copy of <tomcat_home>\webapps\webapi\WEB-INF\classes\fieldExclusionRule.properties and give the file the same name as your rule. For example <tomcat_home>\webapps\webapi\WEB-INF\classes\fieldExclusionRule2.properties
- Define your rules in this file.
- Save all your changes and then restart Tomcat or the SuperWEB2 service.