Report script

Using a report script, you can add programming to the report, for example because you want to use fields that are in different sections of the report.

For a calculation that only uses fields that are in the Detail section, you can add a function field.

Description

General tips:

  • Do not refer to an element that is in another section. Should that be necessary, use a variable in the global script to pass on the value.
  • For date and time fields, you can select a deviating format in the data collection, such as Date (international). If you use this kind of format, Profit will consider the field to be a text field. This means you can no longer use the field in calculations and that Profit will apply an alphanumeric sorting if you sort by the field.

Create layout and Print events

For every section there are two events: Create layout and Print:

  • Create layout

    Using this event, you can determine the text of a text field or change a property of a field of any other type. During this event, reducing or increasing the size of each field and the detail section also takes place. Of course this only happens if the Decrease acc. to contents and/or Increase acc. to contents check box is selected for a field or the detail section. Because the resizing is carried out during this event, it is not recommended to query on the height of a field or the section. This is because the result will not necessarily be the exact height.

  • Print

    Use this event to set the size of a field or the section. The correct size has already been determined during the Create layout event. Usually, running scripts using formulas (comparisons, calculations, etc.) takes place in this section.

Every event is performed once for every line in the detail section. The order in which this happens is not always the same. For example, it may occur that the Create layout event is performed first, and then the Print event for each line. But it may also occur that the Create layout event is performed first for all lines, and then the Print event is performed for all lines.

Determine the value of a check box

If scripting is used to determine the value of a check box, use the 'True' and 'False' values (not 0 and 1 or Y and N).

Example:

If {Check box} = True Then
  Result = “Yes"
Else
  Result = “No"
End If

Procedure
  • Complete a function field

    You can use a script to assign a value to a field and include the field in the report layout.

  • Conditional formatting

    Using a report script, you can format report fields based on a condition (comparison). This allows you to, for example, emphasize certain data in a report.

  • Hide detail section lines

    You hide specific detail lines when you print a report.