Block Map View when Certain Fields Appear in the Table - SuperWEB2
You can use SuperADMIN to configure a blacklist of field items that you want to restrict from mapping. Users will not be able to access Map View if the table contains one of the blacklisted field items.
The blacklisted field items must come from a value set that is already mappable. This feature allows you to select specific field items from within a field that is otherwise mappable, and prevent access to maps if those items are in the table.
To configure a list of blacklisted field items, you need to:
- Find the codes for the items you want to blacklist. You can do this by adding them to a table in SuperWEB2 and clicking the code button in the table header.
Use the SuperADMIN
cfg
command to create the blacklist:CODE> cfg global superweb2.mapping.dumpCodes set <list_of_codes>
Any changes you make to the blacklist in SuperADMIN are applied immediately. However, if you currently have the dataset open then you will not see the effect of the changes until you reselect the dataset from the catalogue.
Worked Example
The following example is based on the sample Retail Banking dataset and the mappable Area field. In this example we will blacklist a selection of the field items so that users cannot create maps if their table includes those items.
Go to SuperWEB2 and create a table containing the field items you want to blacklist. For example, there are a number of regions in the Area field that we might want to exclude from mapping, such as Off-Shore Areas & Migratory and Unknown.
When you have added them all to the table, select the Codes option from the drop-down menu to show the value codes:
SuperWEB2 displays the codes:
Go to SuperADMIN.
Before you add your new blacklisted field codes to the configuration, it is important to check if there are any existing blacklisted field codes already defined. This is because the
set
command will replace any existing blacklisted codes with your new list.Use the following command:
CODE> cfg global superweb2.mapping.dumpCodes
SuperWEB2 will either display the list of existing codes, or display "not found".
No Existing Blacklisted Field Codes Defined
If there are no existing blacklisted fields, SuperADMIN displays the following message:
CODE> cfg global superweb2.mapping.dumpCodes superweb2.mapping.dumpCodes : not found
In this case you can use the
set
command to add all the new blacklisted codes. Specify each code in quotes, separated by commas and with square brackets at the start and end of the list:CODE> cfg global superweb2.mapping.dumpCodes set [ "185", "285", "385", "485", "585", "685", "785", "-1" ]
Existing Blacklisted Field Codes Defined
If there are already some blacklisted codes defined, then SuperADMIN displays a list of the current blacklisted fields. For example:
CODE> cfg global superweb2.mapping.dumpCodes superweb2.mapping.dumpCodes : ["123","125","127"]
In this case, if you use the
set
command it would replace these blacklisted codes with your new list. You have two choices for updating the list to include your new codes:Use the
add
command to add each one individually. For example:CODE> cfg global superweb2.mapping.dumpCodes add "785" superweb2.mapping.dumpCodes : Updated > cfg global superweb2.mapping.dumpCodes add "-1" superweb2.mapping.dumpCodes : Updated > cfg global superweb2.mapping.dumpCodes add "585" superweb2.mapping.dumpCodes : Updated > cfg global superweb2.mapping.dumpCodes add "485" superweb2.mapping.dumpCodes : Updated > cfg global superweb2.mapping.dumpCodes add "385" superweb2.mapping.dumpCodes : Updated > cfg global superweb2.mapping.dumpCodes add "285" superweb2.mapping.dumpCodes : Updated > cfg global superweb2.mapping.dumpCodes add "185" superweb2.mapping.dumpCodes : Updated
Use the
set
command, but specify the existing codes in addition to the new ones (it is not important what order you list the codes in). For example:CODE> cfg global superweb2.mapping.dumpCodes set [ "123", "125", "127", "785", "-1", "585", "485", "385", "285", "185" ] superweb2.mapping.dumpCodes : Updated
When you have finished adding the codes in SuperADMIN, go to SuperWEB2.
There is no need to restart SuperWEB2 to see the changes, but if you already have the dataset open in SuperWEB2, you must go to the catalogue and reopen it to access your updated configuration.
Create a table containing one or more of the blacklisted field values, and verify that Map View is no longer available. Remove the blacklisted fields from your table and verify that Map View is available again:
In this example Map View is unavailable because the table contains "Off-Shore Areas & Migratory":
The Map View tab becomes available once this field value is removed from the table:
The text for the error message ("You have included non-geographic items...") is defined in <tomcat_home>\webapps\webapi\WEB-INF\classes\common_labels.properties (and the equivalent versions of this file for the different languages and locales). If you choose to modify the error message, make sure you do so in all the localised versions of this file.