Change Default Summation Option
In SuperWEB2 you must have at least one summation option in the table at all times. When you first add a field to the table, SuperWEB2 automatically adds a summation option.
For example, for the Retail Banking database, the default summation option is a count of customers:
The default summation option is specified in SuperCHANNEL when the SXV4 is created. The recommended way to change the default summation is to update the SuperCHANNEL project and recreate the SXV4. However, if this is not an option, you can use the SuperWEB2 Rules Engine to specify a different default summation option.
The ability to change the default summation option is not a security feature and does not stop a user from manually applying a different summation option to the table. The default summation is simply intended to guide users when they first start creating a table.
The OverrideDefaultSummationRule
configuration described here has been deprecated. The mandatory fields rule now supports summation options and is the recommended method for configuring a specific summation option to be required in a table.
To change the default summation option, you need to modify <tomcat_home>\webapps\webapi\WEB-INF\data\.repository\RulesEngine.xml
Make a backup copy of this file before making any changes.
To change the default summation, you need to make two changes to the rules:
Step 1 - Define the Default Summation Rule
Locate the following section of code and remove the comments from the start and end (i.e. remove the <!--
and -->
):
<!--
<rules:EditRule name="OverrideDefaultSummationRule"
applicableOperations="add"
implClassName="au.com.str.webapi.services.database.manager.rules.impl.OverrideDefaultSummationRule">
<rules:impl-class-init>
<rules:init-param name="Retail Banking" value="Customer Profit:MEAN"/>
</rules:impl-class-init>
</rules:EditRule>
-->
This includes one example rule for overriding the default summation: it changes the default summation option for the sample Retail Banking database to be the Mean of the Customer Profit summation option.
You can add multiple rules to set the default summation for each of your databases. Use the display name of the database to identify it, and then specify the display name of the fact table or summation option, followed by the statistical function. Valid functions include:
- SUM
- MEAN
- MEDIAN (only available if the median has been enabled using the
cat addstatfunction
command for this database) - COUNT (a count of the records in this fact table)
For example:
<rules:EditRule name="OverrideDefaultSummationRule"
applicableOperations="add"
implClassName="au.com.str.webapi.services.database.manager.rules.impl.OverrideDefaultSummationRule">
<rules:impl-class-init>
<rules:init-param name="Retail Banking" value="Customer Profit:MEAN"/>
<rules:init-param name="Australian Real Estate" value="Price Paid:MEDIAN"/>
<rules:init-param name="Customer Database" value="Account Profit:SUM"/>
<rules:init-param name="Employee Records 2014" value="Employees:COUNT"/>
</rules:impl-class-init>
</rules:EditRule>
Weighted Databases
For weighted databases, you also need to specify the weight name in the rule, as follows:
<rules:init-param name="<database>" value="<measure>:<weight name>:<statistical function>"/>
For example, the following rule configures the default summation for the database called Weighted Survey to be the mean of the daily intake measure, using the person level weight:
<rules:init-param name="Weighted Survey" value="Average daily intake over week:Person level weight:MEAN"/>
Step 2 - Uncomment the Rule from CDataOnlineEditRules
Locate the following section:
<rules:RulesPipe name="CDataOnlineEditRules">
<!-- <rules:rule-name name="OverrideDefaultSummationRule"/> -->
Remove the comments from the OverrideDefaultSummationRule:
<rules:RulesPipe name="CDataOnlineEditRules">
<rules:rule-name name="OverrideDefaultSummationRule"/>
Once you have completed these changes, you will need to restart SuperWEB2 or the Tomcat service in order for the changes to take effect.