> ### Using named expressions

> A named expression calculates a value using JavaScript for use in a Java or JavaScript event handler. A named expression provides straightforward access to the result of a calculation to event handlers in either language. These expressions provide access to JavaScript functions, such as BirtDateTime, to Java code.

> You create the named expression on an element. The expression that you define provides the default value for the name. Event handler code in onPrepare can modify this expression definition. The BIRT framework evaluates the expression after OnPrepare runs and before onCreate runs. Code in onCreate and onRender can access the value of the evaluated expression. For example, a named expression called DaysPastDue has the following expression:

> BirtDateTime.diffDay( row["DueDate"], BirtDateTime.today( ))

> You access the named expression in an event handler using code similar to the following line:

> rc = this.getNamedExpressionValue( "DaysPastDue" );

(c) Copyright Actuate Corporation 2009