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 could not find any other way. Many report methods are generic and you can select them within any section (for example, Is page last in report), while others 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 using 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
You want to print the value for an invoice in words instead of as a value (or both). This may be applicable if you are designing an AP Cheque report.
Select the section containing the database value field the method applies to, and 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 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. For this reason, it is always good practice to rename the version of the method you create, so that it reflects it's purpose in the section.
The new 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.
In this case, the method does not require any input to determine the result — the text This method has no parameters indicates this. 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.
If you want the word version of the value to be the only one seen on the report, you can hide the lcNetAmount field.
Here's an excerpt of the output:
Example 2
You want to print a report displaying customers and current balances, including child accounts. To retrieve the current balance for a customer in the Customer class, you must use a method. 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 could not use a true/false property as input to a date field.
In this example, you can use the customer's current period end date, which can be selected from the Database field list and dragged 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 cannot find a method to give you the result you desire, contact your Greentree consultant.