Reference to system variables

Top  Previous  Next

You can use the following system variables in expressions (they are accessible in the "Data" window):

 

Variable

.Net data type

Description

Date

DateTime

Date and time of the report's start.

Page

int

Current page number.

TotalPages

int

Total number of pages in the report. To use this variable, you need to enable the report's double pass. You can do this in "Report|Properties..." menu.

PageN

string

Page number in the form: "Page N".

PageNofM

string

Page number in the form: "Page N of M".

Row#

int

Data row number inside the group. This value is reset at the start of a new group.

AbsRow#

int

Absolute number of data row. This value is never reset at the start of a new group.

 

Every variable has a definite data type. And on this, depends how it will be used in the expression. Here is an example of an expression where date is being used:

 

[Date].Year

 

This expression returns the current year. As "Date" variable has DateTime type, we can refer to its "Year" property. We can get the current month similarly ([Date].Month).

 

FastReport converts reference to system variable into the following form (for example, the "Date" variable):

 

((DateTime)Report.GetVariableValue("Date"))