Language:


Creating a Report Generator Report - Adding Check Boxes to the Specification Window - Exclusive Search Controlled by Check Boxes

This page describes using check boxes to control exclusive searches in Report Generator reports. Please refer here for details about controlling inclusive searches using check boxes.

---

Exclusive searches start from the point where every record in a particular register will be listed in a report, and records are removed from the report if they meet the criteria controlled by the check boxes. On this page, we will illustrate an exclusive search in a Contact List report by adding a check box that will exclude companies with fax numbers. Follow these steps:

  1. Create a new report in the Report Generator module. On the 'Data' card, specify that the Contact register is to be the primary register. On the 'Layout' card, design the output of the report as required.

  2. Go to the 'Input' card, and click the [Check Box] button above the report display area. The 'Check Box' dialogue box opens:

    Label
    Enter the name of the check box, as it will appear in the specification window. The Label should indicate the purpose of the check box to the person producing the report.

    Variable Name
    Enter a name for the boolean variable that is controlled by the check box. 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.

    This variable will be set to 1 if the person producing the report ticks the box in the specification window. Otherwise, it will be set to 0.

    Default Checked
    Select this option if you want the value of the variable to be set to 1 by default. The check box will be ticked when the specification window opens. If you do not select this option, the value of the variable to be set to 0 by default and the check box will not be ticked when the specification window opens.

    Width
    This field is not used in check boxes.

    h, v
    Use these two fields to specify where you want the check box to be placed in the specification window. Enter co-ordinates (in pixels) for the top left-hand corner of the check box (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 Standard ERP vertical spacing of 20 pixels between check boxes.

  3. Click the [OK] button. The check box is placed in the report display area. This shows what the specification window will look like:

    Placing the check box in the specification window in this way has the effect of declaring the variable, so there is no need to do this on the 'Data' card as well.

  4. At the moment the check box exists only in the specification window. Now you need to specify what should happen when the user selects it. In this example, if the person producing the report ticks the box, there should be a search for Contacts with no Fax Number, thus effectively removing those with Fax Numbers from the report. If they do not tick the box, then there should be no search and Contacts with and without Fax Numbers should be shown in the report.

    Change to the 'Data' card. Click on the line in the report display area marked "Register: Contacts..." to specify that the search is to be carried out in the Contact register, and then click the [Print If] button.

  5. Enter a formula in the 'Print If' dialogue box as shown below:

    The formula is:

    (cExclFax == 1 and blank(vrContact.Fax)) or (cExclFax == 0)

    This states that if the check box (cExclFax) is ticked (i.e. when the value of cExclFax is 1), there will be a search for Contacts with no Fax Number. Otherwise (i.e. if the check box is not ticked and so the value of cExclFax is 0), there will be no search and no other action will be taken. In the expression vrContact.Fax, "Fax" is the internal name for the Fax Number field in the Contact register.

    blank is a function inside Standard ERP that you can use to find records in which a specified string field is empty. You can also use string_fieldname == "" (e.g. vrContact.Fax == ""). Use !blank, nonblank or string_fieldname > "" to find records where a specified field contains a value (i.e. any value). In the case of decimal and integer fields, empty and zero are not necessarily the same. num_fieldname == 0 will find records where a specified decimal or integer field is empty or contains the value 0. blank(num_fieldname) will only find records where the decimal or integer field is empty, not those where it contains the value 0.

  6. Click the [OK] button to add the Selection to the Contact register section of the report display area:

  7. When the report is produced without using the new option, it will list every record in the Contact register. When the report is produced using the new option, it will only list records in the Contact register that do not have fax numbers.

    A possible improvement to the Skip Contacts With Fax No. check box might be to offer options to print Contacts with Fax Numbers only, Contacts without Fax Numbers only, and Contacts with and without Fax Numbers. This would be accomplished more efficiently using radio buttons and is described here.

Adding a Second Check Box

You can add extra check boxes to the report, but they should also initiate exclusive searches (searches that remove records from the initial selection). In this example, we will add a check box that will exclude Contacts with email addresses from the report.
  1. On the 'Input' card, add a new check box to the specification window of the report, as described in step 2 above.

  2. On the 'Data' card, add a new Print If condition to the Contact register section, as described in steps 4-6 above.

    "eMail" is the internal name for the Email Address field in the Contact register.

    The result will be two "Print If:" lines in the report display area. The order of these two lines is not important.

    When there is more than one "Print If:" line in the report display area, they are treated as having the logical operator "and". There will be a search for records that meet the first condition and that meet the second condition. Another way to do this is to join the two "Print If:" lines together:

    ((cExclFax == 0 or blank(vrContact.Fax)) or (cExclFax == 0)) and ((cExclEmail == 0 or blank(vrContact.eMail)) or (cExclEmail == 0))

    Note that each check box condition is enclosed in its own set of brackets. The two parts of a single exclusive check box condition are joined by "or", while several check box conditions are joined together using "and". This ensures that there will be a search for records that meet condition one and that meet condition two.

    The specification window will now contain two options that you can use in the following ways:

    Neither option ticked
    The report will list every record in the Contact register.

    One option ticked
    The report will list records without fax numbers or records without email addresses, depending on the option chosen.

    Both options ticked
    The report will only list records without fax numbers and without email addresses.
For details about the syntax that you should use when entering a formula in the 'Selection' dialogue box, please refer to the Syntax page.

Please follow the links below for more details about:

---

Go back to: