4.3.5 Automatically Substituting JavaScript For SQL

There are certain conditions that may prevent a SQL expression from being executed properly (for example, if your particular database does not honor the Data Block 'Maximum Rows' setting or the administrative 'Query Maximum Row Count' setting). To prevent the expression script from failing in such cases, you can provide a fall-back JavaScript expression to be evaluated when the SQL script cannot be executed.

To include a fall-back JavaScript expression, simply enclose the desired JavaScript expression within /*script [...] script*/ tags. For example:

CASE WHEN field['Returns.Return Total'] IS NULL THEN field['Orders.Order Total']

ELSE field['Orders.Order Total']-field['Returns.Return Total']

END

 

/*script

if(field['Returns.Return Total'] == null) {

   field['Orders.Order Total']

}

else {

   field['Orders.Order Total']-field['Returns.Return Total']

}

script*/

In this case, the JavaScript version of the expression within the /*script [...] script*/ tags will be executed only if the SQL version cannot be executed.

<< 4.3.4 Creating an Expression/Formula Column © 1996-2013 InetSoft Technology Corporation (v11.4) 4.3.6 Creating a Numeric Range Column >>