Download Elixir Report Designer User Manual
Transcript
Chapter 6 Scripting with JavaScript Overview Elixir Report Designer supports JavaScript 1.5 as standardized by the European Computer Manufacturer's Association(ECMA) as ECMA Script version 3. This document details some of the features of JavaScript and their use within the Report framework. In Elixir Report Designer, scripts are always rendered in the order that the bands appear in the output. Within a band, scripts in RenderIf will be rendered first. It will be followed by OnRenderBegin, OnRenderEnd, then OnLayout. As for the element(s) in each band, scripts of each element will run in the order the elements appear in the Shapes tree (Z-order). JavaScript is a weakly typed, object-based scripting language modeled on Java syntax. It is a casesensitive language and the following key-words are reserved. It is a case sensitive language and the following keywords are reserved. Table 6.1. JavaScript Keywords break else instanceof true case false new try catch finally null typeof return var continue for default function switch void delete if this while do in throw with Three primitive types are available: Numbers, Booleans and Strings, along with two compound types: Objects and Arrays. Number Numbers in JavaScript are represented internally using 64-bit floating point values - there is no integer type. Numbers may be written in decimal form: 10, 20.5, 30, exponent form: 3e-2 or hexadecimal: 0xFF. JavaScript supports all conventional mathematical operators, including +,-,*,/ and % (modulus). The Math object provides additional functionality, such as sqrt, power, sin, cos, tan etc. Certain operations may yield errors with invalid input, for example Math.sqrt(-1) produces the result NaN - a special value which indicates the result is Not A Number. Boolean The Boolean type has two values: true and false. Boolean can be used as a function: Boolean(x) where the result is true unless x is 0, NaN, null, undefined or "" (the empty string). 76