Javascript functions

Omniscope JavaScript Functions Guide

Functions available for JS scripting from within Omniscope.

Note: This type of scripting should not be confused with browser scripting within an embedded web browser.

Formula functions 

Many standard formula functions are also available for direct use in JavaScript. These are documented in the Functions Guide.  Look for "In scripts" in the Usage column.

All functions behave identically to regular formula functions, as documented, with the exception of subset_uniquesList() which returns a Javascript array rather than a comma-separated String. Functions that are not supported can be accessed using formula() - see below - or by requesting it to be upgraded by posting on the forums.

Additional JavaScript functions available:

The following functions are not in the functions guide, since they are only available in JavaScript:


formula("IF(RAND<0.5, true, false)") 

Dynamically evaluates an arbitrary formula using normal formula syntax.  This supports all functions in the functions guide, but you must build up a valid formula as a Javascript String.


dataArray() or dataArray(fields) or dataArray(fields, rowSubset)  or dataArray(fields, rowSubset, includeFieldNames) 

For example: dataArray( ["Field 1", "Field 2"], subset("Region", "Europe"), true )  

Returns a two-dimensional array of cell data, structured as [column][row], indexed from 0 to n-1.  See example.  If includeFieldNames is true, the first 'row' will be the field names (the first entry in each column array).