Methods

Use methods to retrieve database values or return collections when the value/collection is not stored in the database. Methods can receive input data and return the result.

Use the Report Writer methods to access information you cannot find any other way. Many report methods are generic and you can select them within any section — for example, Is page last in report. Other methods are specific to certain classes — for example, Get Employee Name is specific to the JCCostLineItem class. You can select methods to add to a report section from the Available Fields Palette.

You can add methods to sections the same way as any other field, and you can use them in calculations and queries. You can also use the result of one method as input to a different method.

Note: Using methods in report design requires some advanced knowledge of Greentree Desktop database structures.

Here are some examples:

Example 1

To print the value for an invoice in words instead of as a value (or both), select the section containing the database value field the method applies to. Then, select the Methods tab in the Available Fields Palette. Find the method Convert Value to Words, right-click, and select Add a Version of this Method.

You must always select Add a version of the method. You can add multiple versions of the same method to use the method more than once in a section, or in different sections. You should rename the version of the method you create, so that it reflects its purpose in the section.

The new version of the method displays beneath the original method with the same name. Double-click the new version or right-click, and select Edit this version of the method to edit the method. This opens the Method Designer form.

The method does not require any input to determine the result. The name defaults to the original method name, but in this case it would be useful to rename the method to indicate the field it relates to — for example, Convert lcNetAmount to Words.

To add the method to the report section, drag it and position it on the report below the field it relates to.

You can hide the lcNetAmount field to display only words in the report.

Here's an excerpt of the output:

method designer 3

Example 2

To print a report displaying customers and current balances, including child accounts, retrieve the current balance for a customer in the Customer class. Select the Customer section, then select the Methods tab on the Available Fields Palette. Find the method Get Total Current including Child Accounts, right-click and select Add a Version of this Method:

You must assign the Period End Date for which the balance applies, and indicate whether to print the balance by parent account. When you are assigning input values to a method, you can enter literal values or drag in database fields, calculations, parameters, or even other methods as long as the property types match. For example, you can't use a true/false property as input to a date field.

In this example, use the customer's current period end date, which you can select from the Database field list and drag into the method designer. Alternatively, if you have set up a period end date as a runtime parameter, you can drag the parameter into the designer, and the method uses the date entered by the user at runtime.

Editing & Deleting Methods

You can remove method inputs by clicking the arrow icon next to the line. To remove a method altogether, right-click the method version in the Methods tab within the Available Fields Palette and select Remove this version of the method. You are prompted with an error message if you try to do this and the method is in use in the report.

Note: If you are designing a report and you can't find a method to give you the result you desire, contact your Greentree consultant.