What are Report Functions? ​
Functions are mini-programs that can access information not available in the report cursor, format information in a specific manner, or perform calculations on report data.
A function consists of a name followed by a set of parenthesis.  Within the parenthesis are function parameters—these are pieces of data that the function needs to process/return information.  Some functions require one parameter only, others require several.
Take a look at these three simple functions to see examples of how a function should be written.
- ADDCRSE - returns a field from the Course table. Â You must pass it the course code field and the name of the field you want to return in quotes.
Example: Â ADDCRSE(cocrse,"codept") returns the course department.
- NICEDATE – returns the date in text format.  You must pass it the date field.  You can also pass it a second date and it will give you the date range in text format.
Example: NICEDATE(cobegdate) returns course begin date, e.g. December 1, 2002.
- GTDUE – returns total amount due for a registration.  You must pass it the course code field and the name ID field.
Example: Â GTDUE(rgcrse,rgid) returns the total amount due for an individual in a specific course, e.g. 250.00.
Parameters: Name ID/Course Code ​
Many functions require the individual’s ID and/or the Course Code.  These fields exist in several databases and are named according to their respective database.  The following lists the Name ID and Course Code fields from the various tables:
Name ID
Table | Field |
---|---|
NAMES | nmid |
REGISTER | rgid |
PAY | pyid |
WKSHPIND (individual workshop table) | wiid |
Course Code
Table | Field |
---|---|
COURSE | cocrse |
REGISTER | rgcrse |
PAY | pycrse |
WKSHPMST (master workshop table) | wmcrse |
LEDGER (Pocket Ledger) | lecode |
The report area determines which of the Name ID and Course Code fields are available in the cursor. Â For example, COCRSE is the available course code field in the Reports > Courses report area. Â But in the Reports > Registrations report area, RGCRSE is the available course code field.
In your functions, you may use whichever field is available in the report cursor. Â To see the list of available fields in your report cursor, click the Data Environment button on the Report Designer Toolbar. Â Then you can scroll down the list of available fields to see which one is available.