MYOB Greentree

HideShow

  • Contents
  • Index
  • Search
 
Display results with all search words

 

Methods


Methods are used throughout Greentree to retrieve database values or return collections when the value/collection is not stored in the database. Methods are pre-defined by Greentree Desktop. developers, and are like 'mini forms' that can receive input data and subsequently return the result.

Several methods have been developed specifically for use within the Report Writer. These allow you to access information you could not find any other way. Many report methods are generic and available to select 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). Methods are available to select for adding to a report section using the Available Fields Palette.

Methods can be added to sections the same way as any other field, and may also be used in calculations and queries. The result of one method can also be used as input to a different method.

Information Using methods in report design requires some advanced knowledge of Greentree database structures.

Using methods is best demonstrated by example:

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.

Whenever you want to add a method to the report, 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.

Once the version is created, it will appear 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 in order 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 make the lcNetAmount field invisible. The image below shows an excerpt of the output:

method designer 3

Example 2

You want to print a report displaying customers and current balances, including child accounts. To retrieve the current balance for a customer within the Customer class, you must use a method. Select the Customer section, then select the Methods tab in 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 you want 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. If you want 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 will be prompted with an error message if you try to do this and the method is in use somewhere in the report.

Information If you are designing a report and you cannot find a method to give you the result you desire, you can contact your Greentree consultant who can forward a request to the Greentree Development Team for a customised method.