Setting Generator Properties

In the Generator Properties dialog, you enter JavaScript code to control the generated column values produced by the Generator operator, and you define the operator’s output schema.

Your code has access to the variables structure, including an object called <variables.yourGeneratorOperatorName>, into which you can insert state variables, using expressions such as:

variables.myOperator.foo = 5;

If your code needs to call external functions or if you need to import other Java classes in order to do your custom processing, you can add these to the .jsi file for your view model.

In this procedure, we’ll use an example in which we create a Generator that outputs data with a single integer column whose values range from 0 to 100.

  1. Double-click a Generator operator. The Generator Properties dialog appears, with the Iteration Controls tab displayed.


  2. (Optional) Edit the Name and Description of the operator.
  3. Enter iteration control code. You control the starting, intermediate, and ending values of your generated columns using code you enter in the Iteration Controls tab. There are three fields, which you define as follows:
    • Initialize:

      Enter expressions that set up any variables you want to use to calculate the values of each row this operator generates. In our simple example, we initialize a counter variable to zero. You can enter any JavaScript code here that would be valid inside a function body.

    • Increment:

      Enter expressions that increment the variables you initialized in the Initialize field. In our example, we simply increment our counter variable. Here, too, you can enter any JavaScript code here that would be valid inside a function body.

    • Condition:

      Enter a Boolean expression. While the expression evaluates to true, the operator continues to provide additional rows of data. When the expression evaluates to false, the iteration stops. In our example, we check for our counter being less than or equal to the value 100.

  4. Select the Column Definitions tab. When you define a Generator operator, you need to specify the schema that the output result set will have, as well as the values the columns will have for each iteration through the loop. You do this using the Column Definitions tab in the Generator Properties dialog.

    For our example, we put the incrementing variable, variables.IntGenerator.x (notice that it must be fully qualified), in the single column’s Definition field. The column name is Count and the type is integer.

  5. (Optional) Edit the column definitions for your schema.
    Action Instructions
    Add column Click Add.
    Delete column Select one or more columns (which are represented by rows in the properties dialog), then click Delete.
    Reorder columns Select one or more columns, then click Move Up or Move Down. (To move multiple columns, the selection must be contiguous.)
  6. Edit the properties of each column in the table as desired.
  7. Click OK to save the information and close the dialog.
Related concepts
Expressions Menu
Related tasks
Creating a JavaScript Include File
Related reference
Properties Dialog Field Descriptions

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.