MYOB Greentree

HideShow

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

 

Queries


Queries are set up at a section level, and you can use them to include or limit the report output based on specific criteria. You can use pre-defined parameters within queries, often if parameters have been set up to represent a range and you want the query to recognise the value of these parameters when filtering the report output.

To set up a query for a section, access the Query/Sort Section Properties, select the option to Display objects based on a query, and select Click to specify the query to launch the Query Designer.

The Available Fields Palette opens, enabling you to select fields to add to the query.

Example

This query is set up in the StockItem Collection section:

query3

Inventory Item Range

Within the StockItem class displayed in the Database tab on the Available Fields Palette (which displays relative to the selected section), click and drag the code attribute as the database property to query. Then select the means of comparison (in this case Is greater than or equal to), and the parameter you are comparing it to. In this case, the ItemCode From parameter, which is entered by the user at runtime. The same logic applies when comparing the code to the Item Code To parameter.

Supercession Indicator

To support the Include Superceded Items parameter, you must set up a query to specify the rules of output based on how the user sets this value at runtime. The true/false combinations for this parameter are:

Include Superceded Items is selected

StockItem:isSuperceded is selected

Expected Result: Print item

Include Superceded Items is selected

StockItem:isSuperceded is not selected

Expected Result: Print item

Include Superceded Items is not selected

StockItem:isSuperceded is selected

Expected Result: DO not print item

Include Superceded Items is not selected

StockItem:isSuperceded is not selected

Expected Result: Print item

Lines 1 and 4 both meet the condition that the Include Superceded Items parameter value and the isSuperceded value are the same, so a query line can be added to specify this condition (results meeting this condition will print). Line 2 is the other line that must be included in the output (Line 3 is the one that is being excluded using this query), and this can be satisfied by adding an Or query line that the isSuperceded value is false.

Note: When you add multiple lines to a query, you can select And or Or to reflect whether all (And) or only some (Or) query conditions must be met to determine the report.

Comparisons

You can add database, method, calculation, total, and other fields to queries, and parameters. The comparison options differ depending on the field you are using in the query and based on what makes sense:

Collections

query collection

Alphanumeric and Numeric Attributes

query attributes

Date Attributes

query date

True/False Attributes:

query boolean

References:

query references

If you select an attribute that is not true or false, you must assign the compare value in the text box. This may be a literal value, or a property dragged from the Available Fields Palette.

Click the arrow icon for options to remove query lines or re-position them.

While the order of query lines does not change the overall query, the order may alter the speed at which the report processes, so be mindful of positioning more selective criteria at the top, which reduces the data the remaining query lines have to work on.

Note: Queries are defined at a profile level. If you want the query to be applicable to all profiles, select the This query is for all profiles option.