Language:


Adding Searches

The report can be improved by adding a search. For example, it might be useful to be able to produce a list of Customers belonging to a certain Category. To do this, you need to place a Category variable in the report specification window, and to program the report to perform a search based on what the user enters in this variable. These two tasks can be accomplished together in a single dialogue box. Follow these steps:
  1. Return to the Report Definition record and go to the 'Data' card.

  2. Click on the line in the report display area marked "Register: Customers..." to specify that the search is to be carried out in the Customer register, and then click the [Selection] button above the report display area. The 'Selection' dialogue box opens:

    The 'Selection' dialogue box is divided into two sections. Use the lower six fields to name the variable and place it in the specification window. Use the first three fields and the Not check box to define the search.
    Field Name
    Paste Special    Fields in the register
    Choose the field that is to be the subject of the search. The 'Paste Special' list will show all the fields in the register you are working with (in the example, the Customer register).

    When the report is produced, there will be a search in the field specified here for the value entered in the variable in the specification window. In the example report, the Customer Category field is the subject of the search, and so this is the field that should be specified here.

    Formula
    Formula is not used in this situation.

    Value
    If you want a default value to be placed in the variable when the specification window opens, specify that default value here.

    Not
    Check this box if you want to perform an "inverse" search, i.e. if you want to search for records that do not match what was entered in the specification window. For example, you can use this option to search for all Customers except those in the Category specified in the specification window.

    Input Label
    Enter the name of the variable, as it will appear in the specification window (as illustrated below). The Label should indicate to the person producing the report what they should type in to the variable.

    Variable Name
    Enter a name for the variable that will hold the search criterion (what will be searched for). Include at least one alpha character in the name and do not use spaces or punctuation marks of any kind. Use the underscore _ instead of a space. Ideally, the variable name should reflect the purpose of the variable.

    The person producing the report will enter their search criterion in this variable in the specification window. When they click the [Run] button, there will be a search in the Field Name that you specified above for records that match this search criterion. In the example there will be a search to find Customers with a Category that matches what the user types in this variable in the specification window.

    Paste Register
    Paste Special    Registers in Hansa
    If you want the person producing the report to be able to use 'Paste Special' to bring a value into the variable, specify here the register whose contents are to appear in the 'Paste Special' list.

    It can be useful to enter a block here, rather than a register. Blocks are not included in the 'Paste Special' list attached to this field, so you will need to type the name of the block yourself. Some useful blocks are:
    PerSClass
    Reporting Periods setting

    PMSClass
    Payment Modes setting

    VATCodeSClass
    VAT Codes setting
    For example, if you want the person producing the report to choose a VAT Code as a reporting criterion, enter "VATCodeSClass" here.

    Width
    Specify here in pixels how wide the variable should be when it is placed in the specification window. Ideally, the width should reflect the number of characters that should be entered in the variable. The default is -1, which means the variable will take up the entire width of the specification window, as shown in the illustration above.

    h, v
    Use these two fields to specify where you want the variable to be placed in the specification window. Enter co-ordinates (in pixels) for the top left-hand corner of the variable (not the label): h (horizontal) is the distance from the left-hand edge of the specification window, while v (vertical) is the distance from the top edge. Defaults are offered: they assume the standard Hansa vertical spacing of 20 pixels between variables.
    The example illustrated below will place a variable named vsCategory in the specification window. The person producing the report will type a Customer Category Code (or range of Codes separated by a colon) in this variable, or select one using the 'Paste Special' link specified in the Paste Register field. There will then be a search for Customers whose Category matches exactly what was entered in the vsCategory variable ("CustCat" is the internal name for the Customer Category field in the Customer register). The search is case-sensitive. If the vsCategory variable is left empty, all Customers will be listed in the report.

  3. When the 'Input' dialogue box is complete, click the [OK] button to close it. The information that you entered in the 'Selection' dialogue box now appears as the first line in the report display area, marked "Selection:":