Adding custom functions from a file

You can create a file with JavaScript functions and add them to QMF for Workstation and QMF for WebSphere®. Use the functions for building different expressions, for example, when you add a calculated column or create a dynamart filter.

About this task

To create and add a custom function:

Procedure

  1. Create a file called functions.js with the description of JavaScript functions and their implementation.
  2. Start each function with the keyword 'function'. For details about syntax, see Syntax for custom functions.
  3. Add a comment before each function.

    The application interprets this comment as the description of the function.

  4. Optional: Define a category to which you add a new function.

    Use the '@category' tag in the comments to add it. If there is no such category, it will be created.

    Note: The following categories already exist in the application:
    • Columns
    • Aggregation
    • Conversion
    • Date and Time
    • Information
    • Logical
    • Math and Trigonometric
    • Misc
    • Text
    • Objects
  5. Place the functions.js file in the QMF for Workstation or QMF for WebSphere user home directory.
    If you want to share functions.js with other users, they will have to copy the functions.js file to their home directories.
  6. Launch or restart your application.

Results

The function is added to the defined category and can be used for building expressions for calculated columns, dynamart filters, and scheduler.

This allows you to implement various features in other QMF objects such as visual dashboards. For example, you can display data retrieved from a table on a map according to address information from that table. For more information, see Displaying data on a map according to address information retrieved from a query.