Previous Page Next Page
Special Fields
Special fields supported by JReport
Inserting special fields in a report
Changing the display type of special fields
Binding links to special fields
Adding conditional formats to special fields
See an example: The SampleComponents catalog, included with JReport Designer, contains reports that have examples of how each component type could be used in a report. For the special field example, open <install_root>\Demo\Reports\SampleComponents\ForSpecialFields.cls
.
Special fields supported by JReport
Special fields are defined by JReport and allow you to easily obtain system information and report-related data and add it to your report. The special fields are as follows:
Date-time
Lists all the datetime type special fields.
- Print Date
Prints today's date (or the current date from your computer).
- Print Time
Prints the current time from your computer.
- Fetch Date
Prints the date when the data is retrieved from the database.
- Fetch Time
Prints the time when the data is retrieved from the database.
- Modified Date
Prints the last modified date of the catalog.
- Modified Time
Prints the last modified time of the catalog.
Computed
Lists all the special fields that are computed based on the report.
- Record Number
Prints the record number (usually placed in the Details panel).
- Group Name
Prints the group name (usually placed in the Group Header/Footer panel).
- Total Records
Prints the total number of records after all the filter conditions are performed, except the ones created in the Filter dialog of Page Report Studio, and the Group Filter dialog and top N or bottom N condition in JReport Designer.
- Total Fetched Records
Prints the total number of records which take part in grouping calculation. The possible result of the special field is as follows:
- If you don't set any filter condition in the Filter dialog of Page Report Studio, print the number of the record obtained after setting the property Maximum Records.
- If you set filter conditions in the Filter dialog of Page Report Studio, print the number of records obtained after performing the filters, even though you have set the property Maximum Records before setting the filters.
- Group Number
Prints the group number (usually placed in the Group Header/Footer panel).
- Total Group Number
Prints the total group number (usually placed in the Group Header/Footer panel).
- Page Number
Prints the page number of the component which it is placed in.
- Global Page Number
Prints the global page number of the whole report wherever it is placed.
- Total Page Number
Prints the total number of pages of the component which it is placed in.
- Global Total Page Number
Prints the global total number of pages of the whole report wherever the field is placed.
- Page N of M
Prints a specific page number out of the total page number of the component which the field is placed in. You can specify the format of this special field. To do this, select this special field, then in the Report Inspector, find the Format property and choose an item from the shortcut list. Besides the items listed here, you can also customize the format. For example, if you want it displayed as "This is page n of m pages", you can input the format string "This is page @PageNumber of @TotalPageNumber pages" into the Format text box.
- Global Page N of M
Prints a specific global page number out of the global total page number of the report. You can specify the format of this special field in the Report Inspector. The operation is the same as Page N of M.
- SQL Statement
Prints the SQL statements used to execute the query. This is often useful for resolving performance issues as you can see exactly what is passed to the database after all the parameter substitutions and filters are applied.
System
Lists all the special fields which get values from the system.
- User Name
Prints the User ID. When viewing the report in JReport Designer, it is the name specified for the User Name option in the General category of the Options dialog (to open the dialog, click File > Options); at runtime, the user name used to log onto JReport Server will be applied.
Besides using as a component in report directly, the User Name special field can also be used in the following cases:
It should be used as username in stored procedures and formulas and as @username in HDS, UDS, SQL statement, APE, JSON, filter conditions, and RLS security conditions.
- Task ID
Prints the internal task ID (a unique time stamp). This special field only works in the JReport Server environment. It returns a NULL value when running in JReport Designer.
- Report Path on Server
Prints the full path of the report in the JReport Server resource tree. If the report is not running on JReport Server, it returns the full disk path of the report. It returns a NULL value if the report is unsaved.
- Report Path on Disk
Prints the full disk path of the report. It returns a NULL value if the report is unsaved.
- Catalog Path on Server
Prints the full path of the report's catalog in the JReport Server resource tree. If the report is not running on JReport Server, it returns the full disk path of the catalog. It returns a NULL value if the report is unsaved.
- Catalog Path on Disk
Prints the full disk path of the report's catalog. It returns a NULL value if the report is unsaved.
Note: You can insert all special fields into web reports and library components in JReport Designer. However, due to the characteristics of Web Report Studio and JDashboard, only these can be rendered and edited at runtime: User Name, Modified Date, Modified Time, Fetch Date, Fetch Time, Print Date, and Print Time.
Inserting special fields in a report
Special fields can be inserted in the report areas listed in Component placement.
To insert a special field into a report:
- Position the mouse pointer at the destination where the special field is to be inserted.
- Click Insert > Special Fields or Home > Insert > Special Fields, and select the required field from the drop-down menu.
Changing the display type of special fields
JReport Designer provides 13 kinds of display types: Text, Image, Barcode, Rank, Text Field, Hidden Field, Text Area, Checkbox, Radio Button, Image Button, Button, List, and Drop-down List. By changing the display type of a special field, you can map the special field to other value or image to be displayed instead.
A special field in a page report created using query resources can be displayed as one of the following general types: Text, Image, Barcode and Rank. It can also be displayed as a basic web control, including Text Field, Password, Text Area, Checkbox, Radio Button, Image Button, and Button. While the special fields in a web report or library component can only be displayed as Text.
The Display Type feature is not supported in page reports created using business views.
To edit the display type of a special field:
- Right-click it and click Display Type on the shortcut menu.
- In the Display Type dialog, select the display type you want the special field to display in.
- If a general display type is selected, take the same procedure as Changing the Display Type of Labels to customize the special field.
If a basic web control type is selected, see Inserting basic web controls in a page report for details about how to make settings of the display type.
- Click OK to accept the changes.
Binding links to special fields
You can make the special fields in a report link with other reports, locations specified by URLs, e-mail addresses, or Blob data type fields. The links can either be simple links or conditional links. With conditional links, different targets can be loaded based on different conditions.
To bind a link to a special field, right-click it and click Link on the shortcut menu, then take the same procedure as described in Binding Links to Labels.
Adding conditional formats to special fields
You can add conditional formats to special fields in a report, then when a specified condition is fulfilled, the format defined on the condition will be applied to the field values automatically. This is very useful to highlight values that might need to be acted on by end users.
Conditional format can be applied only to the two special fields: Page Number and User Name.
To add conditional format to the special field Page Number/User Name, right-click it and select Conditional Formatting from the shortcut menu, then take the same procedure as described in Adding Conditional Formats to DBFields.
Previous Page Next Page