Skip to main content
Skip table of contents

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.

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 -->):

HTML/XML
<!--
	<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:

For example:

XML
 	<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:

CODE
<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:

CODE
<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:

HTML/XML
    <rules:RulesPipe name="CDataOnlineEditRules">
        <!-- <rules:rule-name name="OverrideDefaultSummationRule"/>    -->

Remove the comments from the OverrideDefaultSummationRule:

HTML/XML
    <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.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.