Jump to: navigation, search

Difference between revisions of "BIRT Functions (BIRT)"

(Description)
 
(2 intermediate revisions by the same user not shown)
Line 11: Line 11:
  
 
== Description==  
 
== Description==  
The attached example illustrates building expressions using native JavaScript functions and built in BIRT Functions,
+
The attached example illustrates building expressions using native JavaScript functions and built in BIRT Functions.  The
 +
example report is a simple list report that uses order details from the sample database to illustrate the functions.  For example
 +
the following is used to set a data element to either true or false. 
 
  BirtComp.between(dataSetRow["QUANTITYORDERED"], 30, 50)
 
  BirtComp.between(dataSetRow["QUANTITYORDERED"], 30, 50)
 +
If the quantity ordered is between 30 and 50 the data element value is set to true, else it is set to false.
 +
Several examples are available in the report.  Additionally the report includes using functions like the regular
 +
expression syntax within the expression builder.
 +
The following expression returns Match if the PRODUCTCODE column contains S18, else it returns No Match.
 +
 +
var expval = "";
 +
var reg = /S18/;
 +
var check = reg.exec(dataSetRow["PRODUCTCODE"]);
 +
if( check ){
 +
    expval="Match";
 +
  }else{
 +
    expval="No Match";
 +
}
  
 
== Comments ==  
 
== Comments ==  

Latest revision as of 12:37, 29 March 2007

< To: Report Developer Examples (BIRT)
Examples for the BIRT Project are contributed using Bugzilla. This example is Bugzilla ID 180025. If you would like to contribute an example see the example contribution guidelines.

Introduction

This example demonstrates using several of the built in BIRT functions available within the Expression builder.

BIRT Version Compatibility

This example was crated and tested with BIRT 2.5 Milestone 4.

Example Files

Example Report

Description

The attached example illustrates building expressions using native JavaScript functions and built in BIRT Functions. The example report is a simple list report that uses order details from the sample database to illustrate the functions. For example the following is used to set a data element to either true or false.

BirtComp.between(dataSetRow["QUANTITYORDERED"], 30, 50)

If the quantity ordered is between 30 and 50 the data element value is set to true, else it is set to false. Several examples are available in the report. Additionally the report includes using functions like the regular expression syntax within the expression builder. The following expression returns Match if the PRODUCTCODE column contains S18, else it returns No Match.

var expval = "";
var reg = /S18/;
var check = reg.exec(dataSetRow["PRODUCTCODE"]);
if( check ){
    expval="Match";
 }else{
    expval="No Match";
}

Comments

Please enter comments below by selecting the edit icon to the right. You will need a Bugzilla account to add comments.