You can use the field exclusion rules to limit the number of fields from a defined group that can be added to the table at any one time. This feature is typically used to restrict the number of sub-state geographies that can be added into a table at the one time.
There are two types of rule you can define:
- Global rules apply to all datasets.
- Dataset rules apply to a specific dataset, in addition to any global rules that have been defined.
The rules are defined as a list of fields and a maximum number. Users will not be able to add more than this maximum number of fields from this group to the table.
Step 1 - Confirm that the Field Exclusion Rule is Active
- Open <tomcat_home>\webapps\webapi\WEB-INF\data\.repository\RulesEngine.xml in a text editor.
Locate the following section and confirm that the
FieldExclusionRuleis active and not commented out:
- Save your changes to the file (if any).
Step 2 - Define the Field Exclusion Rules in SuperADMIN
Before starting to create new rules, you should check whether there are any existing field exclusion rules defined. Login to SuperADMIN and use one of the following commands:
To check for existing global rules, use the following command:
To check for existing dataset rules, use the following command (replace
SuperWEB2 will either display the list of existing rules (if some rules are already defined), or display "not found".
Scenario A: No Existing Rules Defined
If there are no existing rules defined, SuperADMIN displays the message "not found":
If there are no existing rules defined, then you can create a new rule using the following commands:
<index>is the rule number. You can create multiple rules, simply make sure each rule has a unique index number, starting from zero.
<dataset_id>is the ID of the dataset this rule applies to (you can obtain using the
catcommand in SuperADMIN).
<limit>is the maximum number of fields from this group that can be included in a table at any one time.
<list_of_fields>is the list of fields. Specify each field in quotes, separated by commas and with square brackets at the start and end of the list.
You can either use the field display names (shown in SuperWEB2) or the field IDs (which you can obtain in SuperADMIN by typing
cat <dataset_id> <field_name>). If you are using multilingual datasets, then you must use the field ID.
For example, the following commands specify that only one of these three fields (Age, Area and Marital Status) can be added to tables created from the Retail Banking dataset at any one time. As this is the first rule defined it has the index value of 0:
If you want to define a second dataset rule, use the same command but increment the index value. For example (this example uses field IDs):
Scenario B: Existing Rules Defined
If there are already existing rules defined, then SuperADMIN displays the details. For example:
In this example there are two rules defined for the Retail Banking dataset (each rule is enclosed in curly brackets).
You can either add a new rule or update one of these existing rules.
To add a new rule, simply make sure that you use the next index value up. In this example, there are already two rules, so to create a third rule you must use the index value of 2 (because the index numbering starts at 0). For example:
To update an existing rule, simply use the index value of the existing rule. For example, to update the limit setting for the second rule (the Occupation/Gender rule), use the index value of 1:
Step 3 - Validate the Rules in SuperWEB2
When you have finished defining your rules, go to SuperWEB2 and create some tables to verify that the rules are defined correctly.
There is no need to restart SuperWEB2 to see the changes, but if Table View is already open, you must go back to the catalogue and reselect the dataset to access your updated configuration. This is also the case for any users who are already logged in: they will not see the impact of the new rules until they reselect the dataset from the catalogue.
Remove Field Exclusion Rules
If you want to remove a field exclusion rule, use the following commands:
For example, to remove the second rule defined for the bank dataset, use the following command (the second rule has the index value of 1, because the rule numbering starts at 0):
When you remove the rule, the index values of any subsequent rules will be updated accordingly to replace the removed rule. For example, if you have three rules defined, the index values of these rules will be 0, 1 and 2. When you remove the rule with index value 1, the index value of the third rule will be updated from 2 to 1.
If you want to remove all the existing field exclusion rules, use the following commands:
For example, to remove all the rules defined for the bank dataset, use the following command: