Writing scripts to populate JavaScript Table

Once you created a JavaScript Table and specified its structure, you need to write a script that will populate the table with the required data.

About this task

You write the script in the JavaScript Table editor according to general JavaScript syntax rules. The editor opens automatically after you close the Create New JavaScript Table wizard.

To manage the content of a JavaScript Table, you can also use the following special functions of the table global object:

To trace HTTP request, response, and record logs, use the log() function.

You can also use prompted variables in the script. A user will be prompted to enter variable values when running a query based on the created JavaScript Table. If you use a prompted variable in the script, note the following peculiarities:
  • The JavaScript Table cache is ignored.
  • When a user works with a JavaScript Table in QMF for WebSphere®, all the retrieved data will be available to that user only.

You can work with the preset modules or create custom ones.

When you finish working with the script, save the changes and close the editor.

Procedure

  1. If you want to work with the preset modules, add JavaScript to them. For more information about modules, see the Modules in JavaScript data sources topic of Administrator Help.
  2. To add a user module:
    1. In the Repository Explorer view, right-click the Modules node of the data source and select New > JavaScript Module.
    2. In the New JavaScript Module wizard, specify the name for the JavaScript Module in the Name field and click Finish to open the JavaScript Module editor.
  3. Type script in the modules and save them.
    Important: If you work with preset modules, do not duplicate names of variables in different modules to avoid conflicts during their execution.