Edit

Custom Settings

You can add your own custom controls or environment variables to your report using the Custom Settings option. Any controls created here will appear below the Sort menu in the Report Settings window, and can be set by the user when the report is run.

Controls can be Check Boxes, Radio Buttons, Pop-up menus, and fields for entering text, numbers and dates, plus just plain text. In addition you can provide scripts to control the Report Settings dialog, and a Privilege Check to control access to the report.

To add a custom control: click the + button

To delete a custom control: highlight the control in the list and click the - button

To move a custom control: Drag the control up or down in the list.

To modify a custom control: 

  1. Double-click it in the list, or highlight it and click the Edit button

The Custom Control window will be displayed.

  1. Set the Control pop-up menu to the type of control you require
  1. Type the name of the control into the Name field

This is what will appear as a label to the control on the Report Settings window, and hence needs to be something meaningful to the user. It is also made available as a variable within the report, so you can access its value. Thus a name of “Number of Students” becomes the report variable Number_of_Students.

    All;(-;Lots;Some;None)

results in the pop-up menu shown on right.

For more information on pre-calculated selections, see Selections.

Check Privilege

Access to the report can be controlled by a specific user privilege (as well as by signing). This is achieved by using the Check Privilege control, and choosing the privilege the user must have to run the report from the supplied list of privileges. For example, the following setting means that a user must have the Account Enquiry privilege set to run the report:

The following will be displayed if a user without the privilege attempts to run the report:

If there is more than one Check Privilege control in the report, the user must have access to all privileges specified. Note that users who do not have the Signing and Using Unsigned Forms and Reports privilege will still need to have the report explicitly signed to them.

Script

You can provide a script as a report control that can (among other things) control the highlighting of your custom controls, or provide some complex form of access control.

Note that the WindowID for the report setup dialog is F_REPSETUP.

Tip: It is much easier to write and debug a script in the script editor window than in the control window. Get it working there, and then create the custom script control and copy and paste the script text. Make sure the control has the same name as the original script, and remember to deactivate the script.

Tip: Public handlers in the report script (or any loaded script. provided the report is not being run on the server) can be seen from the report, allowing you to make custom functions that can be used by the report. For example the following handler in a script control named “repScript”:

    on trickycalculation(x, y) public

would be accessed from the report by something along the lines of:

    =repScript:trickycalculation(3.141, 42)

See the Recurring Transaction report, which contains a script to calculate the next recurrence of a transaction, for an example of this.

Note: You can include an on SetupReport handler in a script. This will run just before the report itself is executed, and allows you to dynamically set a column width in the report, as in the following example:

    on SetupReport
        SetReportColumnWidth("TAXCOL",if(Val("Show_Tax"), 80, 0))
    end

If the handler returns false, the report will silently abort.

For more information on scripts, see Scripts, Automation and the REST of it.