rowList

The rowList() function generates a list of values from a result set with column grouping, conditional filtering, and other sorting options.

rowList(tableLens, 'conditional spec', 'options string');

e.g., rowList(q, 'quantity ? discount > 0','sort=asc');

Here, conditionalspec is the column name with grouping or conditional specifications, and the options string values are as follows (multiple options are separated by a comma delimiter):

sort=asc/desc/false: Sort the values in ascending or descending order. Default is false.

distinct=true/false: Retrieve only distinct values. Default is false.

maxrows=num: Limit the number of elements returned.

sortcolumn=column_name: Sort data according to a specific query column which is not returned in the list.

The variable 'q' contains the results of a query. It is usually generated in onLoad Handler script by the runQuery function, e.g.,

var q = runQuery('All Sales').

The rowList() function also adds the fields of the result set to the formula scope of the table cells, so that they can be accessed as field['colName']. Therefore, you can use rowList() to extract a portion of a query result set, and then fill out the table with other fields of the result set which correspond to the records of the extracted row:

Example: The rowList Function  >>

Consider a formula table based on the 'All Sales' query. Assume that you want to extract all of the 'Order Numbers' where the total sales are greater than 6000, and then fill the next cell with the employee associated with the order.

rowList(q,'Order Number? Total >6000');

field['Employee']

 

 

The output is shown below.

 

 

See Also

field, for more information about accessing columns of a result set.

<< toArray © 1996-2013 InetSoft Technology Corporation (v11.5) mapList >>