PXML functions

The PXML expression language has a BDL-like syntax which uses functions to define the value of properties.

Table 1 shows the most common functions used in PXML expressions.

Table 1. Common PXML functions
Function Description
numeric max(numeric, numeric) Returns the greater of two numbers.
numeric min(numeric, numeric) Returns the lesser of two numbers.
numeric length(string) Returns the height of a string.
numeric width(string) Returns the width of a string.
For example, this expression uses the functions max and width:
max(10cm,width("HELLO"))

In this example, the report engine first calculates the width of the string "HELLO", taking the current font metrics into account. It then determines which is larger (10cm or the calculated width of "HELLO") and returns the larger value.

Page number functions

Table 2 shows the PXML functions related to page numbering in the report. These functions can only be used in properties that yield a PXML String expression; that is, the Text Expression property of the Page Number and the Code Value Expression property of the Bar Code Box. For further details, see Using a page number string.

Table 2. Page number functions in PXML
Function Description
string format(string, [ARABIC|LOWERROMAN|UPPERROMAN]) Sets the format of the page number string.
numeric getPageNumber(string) Returns the current page number of the specified page.
numeric getTotalNumberOfPages(string) Returns the total number of pages for the specified page.
numeric getPhysicalPageNumber() Returns the current page number of the physical page.
numeric getTotalNumberOfPhysicalPages() Returns the total number of physical pages.

Odd and even page functions

Table 3 shows the PXML functions that indicate whether the total number of physical pages is odd or even. These functions can only be used in properties that yield a PXML Numeric expression. For further details, see Start on an odd or even page.

Table 3. Odd and even page functions in PXML
Function Description
boolean oddPhysicalPage() Returns TRUE if, when the size is computed, the total number of physical pages (including the page currently under construction) is odd.
boolean evenPhysicalPage() Returns TRUE if, when the size is computed, the total number of physical pages (including the page currently under construction) is even.

Mathematical functions

Table 4 shows the mathematical functions that can be used in PXML expressions.

Table 4. Mathematical functions in PXML
Function Description
numeric abs(numeric) Returns the absolute value of a number.
numeric acos(numeric) Returns the arc cosine of an angle.
numeric asin(numeric) Returns the arc sine of an angle.
numeric atan(numeric) Returns the arc tangent of an angle.
numeric atan2(numeric x, numeric y) Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).
numeric cos(numeric) Returns the trigonometric cosine of an angle.
numeric pow(numeric x, numeric y) Returns x raised to the power of y.
numeric rad(numeric) Converts an angle from degrees to radians
numeric sin(numeric) Returns the trigonometric sine of an angle.
numeric sqrt(numeric) Returns the correctly rounded positive square root of a double value.
numeric tan(numeric) Returns the trigonometric tangent of an angle.

Bar code functions

Table 5 shows the toBinaryString() function, which can only be used in the Code Value Expression property of the Bar Code Box.

Table 5. Bar code functions in PXML
Function Description
string toBinaryString() Returns the binary representation of a value. For further details, see OMR.

Page break functions

Page break functions shows the page break functions that can be used in PXML expressions.

Table 6. Page break functions in PXML
Function Description
numeric physicalPage(numeric) Sets the page number to place a page break.