Add Defined Fields

User Defined Fields (UDFs) are new (synthetic) fields that you can create directly in SuperCROSS based on existing fields and measures.

You can use UDFs to do things like:

  • Compare two numeric fields.
  • Perform calculations across several numeric fields.

  • Range or band a continuous numeric field.

  • Copy data from a child fact table to a parent. For example, deriving household income based on individual income.

  • Determine if a parent object contains any children.

  • Calculate a time or data span.

  • Apply weights to a value set to be used in a subsequent calculation.

You can recode UDFs and in some instances use them to create other UDFs to build up complex results.

If you have created UDFs in SuperCROSS then you can add these to your SuperWEB2 server. The UDFs will appear in the field tree for use by SuperWEB2 users just like any other field in the dataset.

Add Defined Fields to SuperWEB2

To add UDFs to SuperWEB2:

  1. Follow the steps in the SuperCROSS documentation to create your UDFs.
  2. Save your UDFs to a file in Textual Defined Field (.txt) format.

    You must use the textual format, not the binary Defined Field (.fld) format.

  3. Copy the .txt file to <tomcat_home>\webapps\webapi\WEB-INF\resources\udf\<dataset_id>\ (where <dataset_id> is the ID of the dataset that the UDF applies to; you will need to create this directory if it does not already exist).

    For example, if you have created a UDF for Retail Banking (ID: bank) you would copy the file to <tomcat_home>\webapps\webapi\WEB-INF\resources\udf\bank\

Your UDFs will automatically be available to any user who accesses this dataset.

For example:

Time span UDF created in SuperCROSS:

The UDF as it appears in SuperWEB2:

Adding Multiple UDFs

If you want to add multiple UDFs to SuperWEB2, then you can either save these to individual .txt files or as a single .txt file with all the UDFs defined in it.

However, if your UDFs have dependencies on each other (for example you have used a UDF in another UDF calculation) then these UDFs must be saved in a single file in order to maintain these dependencies in SuperWEB2.

Ensure your UDFs have Unique Names

Take care to ensure that all your UDFs have unique names. If you add multiple UDFs with the same name, then users will be able to create tables but will not be able to save tables containing these UDFs.

Invalid UDFs

If you create a UDF that is not valid for a particular dataset (for example because you have saved the UDF file to the wrong directory on the SuperWEB2 server) then this will be ignored. When SuperWEB2 encounters an invalid UDF in a .txt file, all UDFs defined in that .txt file will be ignored and will not be available in SuperWEB2.