Style Intelligence provides a few global functions in addition to those defined by the standard JavaScript runtime (see Appendix JS:General JavaScript Functions). This section presents the additional functions.
Adds a parameter to the report. This function is available only within the onInit Handler, and is equivalent to defining a report parameter using the 'Parameter Definition' dialog box in Report Designer.
Parameters
parameter name name of the parameter (String) parameter default parameter default value parameter type one of the constants defined in XType parameter alias label (String) to use when prompting hidden flag Boolean: false (default): prompt user true: do not prompt user
Example
addParameter('start_time', new Date(), XType.DATE, 'Start date', false);
The 'hidden' flag allows you to suppress user prompting for the parameter, equivalent to deselecting the 'Prompt User' option in the 'Parameter Definition' dialog box.
Creates a new Java object.
class name (String)
var presenter = newInstance('inetsoft.report.painter.IconCounterPresenter');
You can usually accomplish the same thing using the 'new' operator, but this sometimes does not handle Java packages correctly.
Loads an image file from a Java resource or string. The getImage() method checks whether the argument specifies a valid resource. If it does not specify a resource, then getImage() treats the parameter as an encoded image. Both ASCII Hex and ASCII85 are supported (useful for XML data).
image file resource path or URL to an image or ascii hex or ascii85 encoded gif/jpeg image data
var img = getImage('/com/mypackage/icon.gif'); img = getImage('http://chart.inetsoft.com/images/inetsoft.png');
// picture column is ascii85 encoded gif image for(var r = 1; r < table.length; r++) { var img = getImage(table[r]['picture']); table[r]['picture'] = img; }
Tests for null value.
a report object
if(isNull(Text1.text)) { // perform action when text for element Text1 is null }
Returns information specified in the Document Info tab of Report Designer.The fields include the following:
string containing document property (e.g., 'report.title')
var text = docInfo['report.title'];
Prints a log message to the server log. If the script is running inside Report Designer, the log message is displayed in the Console window.
log message string
log('onLoaded called');
Returns a result set as a two-dimensional array that can be assigned to a Table, Chart, or Section.
query_name a string containing the query name parameters (optional) a two dimensional array string array, each row containing a name value pair that corresponds to a query parameter
var rs = runQuery('orders',[['category','Business'],['price',100]]);
Copyright © 2024, InetSoft Technology Corp.