10. The Report menu
10.12 Report options
Report Document Properties Opens the report document properties dialog, see 10.11 (Report document properties).
6.2.2 Group header/footer floating menu
Right clicking on a node labeled 'Group Header' or 'Group Footer' produces a floating menu as shown on the right.
The following table explains all the options of the floating menu for the details section.
Function Description
Group Expert Opens the group expert dialog, see 10.6 (Group expert).
Delete Group Delete this group from the report.
Hide Section Toggling the option to hide or show a section.
Section Expert Start the Section Expert, see 10.4 (Section expert).
Fit Section Changing the size of a section, automatically removing white-space in the bottom of a section.
Insert Section Below Insert a new section and place it below an existing section.
Select All Section Objects Select all objects in a section. (For example to move, or Delete all at once).
6.2.3 Details section floating menu
Right-clicking on the node labeled "Details" (or at 'Report Header', 'Page Header', 'Details', 'Report Footer' and 'Page Footer') produces a floating menu as shown on the right.
The following table explains all the options of the floating menu for the details section.
Function Description
Hide Section Toggling the option to hide or show a section.
Section Expert Start the Section Expert, see 10.4 (Section expert).
Fit Section Changing the size of a section, automatically removing white-space in the bottom of a section.
Insert Section Below Insert a new section and place it below an existing section.
Select All Section Objects Select all objects in a section. (For example to move, or Delete all at once).
6.2.4 Database field floating menu
Right-clicking on the database field node (such as a node labeled
"OrderHea.Customer_Number") produces a floating menu with database field specific options as shown on the right.
The available options of the menu are explained in the following table.
Function Description
Field Properties Setting the Field Properties, see 8.4 (Field properties).
Browse Field Data Opens a panel that shows the content of the database field.
Insert Sum Add a sum of a field Summary.
Lock Size/Position Toggle the switch that enables or disabled movement and resizing of objects.
Suppress Toggle the switch to show or hide the object in a report.
Forward Switch the position of the current field in the report layout with the next field. This way the current field will be used/executed after the next field has been processed.
To Front In case objects overlap, an object can be made visible by moving it to the front. For example: Place text to the front, and a picture in the background.
Backward Switch the position of the current field in the report layout with the previous field. This way the current field will be used/executed after the previous field has been processed.
To Back In case objects overlap, an object can be moved to the back.
Size to Font Resizes the object to fit the size of the used font
6.3 Repository explorer
The repository explorer shows information about the datasource location. A tree view shows the stored repositories.
Existing repositories can be renamed, viewed or removed from the system.
The screenshot below shows the information you get when you click the properties button in the Repository Explorer’s toolbar. You can see the name
of the repository, the tables used, the database name, connection string, if applicable the schema name and number of relationships.
You can create a new report based on a stored repository. Repository records are created during report construction via the standard report wizard, or via the Database expert.
6.4 Arrange Objects
The Arrange Objects panel is used to manipulate the size or position of multiple objects in the Report relative to each other.
6.4.1 Resizing objects
Select one or more objects in the Report that you wish to change, select the number of points that you wish to change in the width (X) and/or height (Y)
change the object(s) sizes accordingly. If you do not enter a value into one of the X or Y dimensions then that dimension is left unchanged.
6.4.2 Moving objects
Select two or more objects in the Report that you wish to change, select the number of points that you wish to change in the left/right (X) and/or top/bottom (Y) dimensions. Select the Distance button and click on the apply button to change the object distances relative to each other. If you do not enter a value into one of the X or Y dimensions then that dimension is left unchanged.
Note when you use the lasso to select multiple objects, the base object is the first selected object in the report explorer.
7. The Insert menu
The ‘Insert’ menu lists several elements that can be inserted into a report, such as a database field, text or graphical objects.
Except for the first option each choice is also available via a comparable button that can be chosen from the insert button bar.
7.1 Field heading
If a database field is selected in the design window and the option ‘Field Heading’ is clicked from the ‘Insert’ menu, a text object is inserted in the 'Page Header' section. The caption is automatically assumed to be the field name. Change the caption by a right mouse click on the text object and selecting ‘Edit Text’ from the context menu.
See paragraph 4.2.1 for the default setting to automatically place a text object with caption in the 'Page Header' section when a database field is added to the report.
7.2 Summary
First select a field that needs to be summarized. Then choose ‘Sum’
from the ‘Insert’ menu. If we choose this for the field ‘qty_ordered’
from the orderdtl table we will see the dialog on the right.
The available summary options in this dialog are:
Function Description
Sum Sums the values of the field (only works on numeric fields).
Average Show the average value of the field (only works on numeric fields).
Maximum Show the maximum value of the field (only works on numeric fields).
Minimum Show the minimum value of the field (only works on numeric fields).
Count Count the number of times that a certain value occurs.
Distinct Count Count the distinct number of times a value occurs (only works on numeric fields).
You can select where the 'Sum' field is placed. This is normally either a 'Group Footer' or a 'Report Footer'. All possible locations are shown.
If your report does not contain a group – see next paragraph – and you would like to place the summary in a group you can immediately create the group by clicking the 'Insert Group' button.
7.3 Group
A ‘Group’ is used to divide data into specific sections and for sorting. For example: Group all orders per customer. The panel for adding a group to a report looks like displayed on the right.
The First combo box is used to select the field on which the grouping takes place. The second combo box defines the sorting-order (ascending or descending).
The ‘Group Name Field’ has per default the same value as the field upon which the grouping takes place. Suppose that the Group is defined as on customer number, but the ‘Group Name Field’ needs to be the customer name this can be changed by checking the checkbox ‘Customize Group Name Field’ to change it to the appropriate field.
By checking the checkbox ‘Repeat Group Header On Each Page’ the section with the header-details are repeated on each page.
7.4 Function field
A ‘Function Field’ is usually a field with content that is derived from another field. A ‘Function Field’ is a calculation based on another field, or a different representation of text.
Select ‘Function Field’ from the ‘Insert' menu and move the mouse cursor to the place in the report where the function field needs to be placed. Press the left mouse button down while dragging, to resize the object as appropriate.
After the field has been placed in the report, the
‘Function editor’ window is activated.
The bottom half is the area for editing the function. You can enter the name of the function but it is not required. If you omit entering a name the name will be "FunctionX", where "X" is the number of the function. You can always change the name later. After entering the function contents you can validate the function by clicking the ‘fx’ button.
Use the three panels in the top half to help in building up the function. Double-clicking on an element in the tree will automatically place the
appropriate piece of code in the editor below, in the function.
There is a tree view for selecting available fields (from report or database), one for selecting a specific type of manipulation (expression or statement) and one for selecting functions.
If a function does not return a value (the 'return' statement is not present), the value returned from the function is undetermined.
Example: If we want a function that returns the first 10 characters from the name of a customer we have to do the following:
Double-click the ‘Return’ expression in the middle tree view. While not shown here the editor part will contain "return" after this.
Double-click the function
‘Left(string,number)’ in the ’Available Functions’ tree view. Make sure that the insertion cursor is placed between the brackets of the ‘Return’ statement.
Edit the second argument of the function (the ‘Number’ behind the comma) to be 10.
Then edit the first argument (the ‘String’
before the comma) by double-clicking the customer name field in the database fields.
Change the name of the function to a meaningful name (e.g. CustomerName).
Check the function by clicking the function-check button in the tool-bar of the function editor window. If no error occurs, the syntax of the function is correct and you can click the OK button to store the function in the report.
7.5 Text object
Select the option ‘Text Object’ and move the mouse cursor to the position in the report where the object needs to go and keep the left mouse button pressed down to create the appropriate size of the object. After releasing the mouse button, text can be edited. Changing the text afterwards can be done by clicking on the object with the right mouse button and choosing ‘Edit Text’ from the context menu or by simply double clicking.
7.6 Line, Box and Picture
Select the option ‘Line’ or ‘Box’ and move the mouse cursor to the position in the report where the line or box has to appear and keep the mouse-button suppressed while giving the line or box the appropriate size.
For adding a picture in a report, first select the picture, then move it to the place in the report and release it in the report by clicking the left mouse button. By default the picture will have the same aspect ratio as the original, and it can now be resized using the mouse.
Images which are stored in a database can also be added. For this, the field which contains the images has to be added to the report.
7.7 Chart object
Select the option ‘Chart Object’ and move the mouse cursor to the position in the report where the chart has to appear and keep the mouse-button suppressed while giving the chart the appropriate size. When the mouse is being released the 'Insert Chart wizard' will appear. See paragraph 3.1 (Adding a chart).
7.8 Sub-report
A sub-report is a report inside another report.
There are specific reasons for constructing reports this way:
Show details of data that is not related to each other. For instance because the data is not related, the data-types do not match, or because the data resides in separate databases.
Combine two or more separate reports into one report.
Showing the same data multiple times in one report, but with different dimensions.
A sub-report can either be linked, or not be linked to the main report. If the reports are not linked, the information is not related, data from one report is not filtered by reference to the data presented in the other report.
It is possible to link reports by using global variables in the filter functions and function fields. The following example shows a main report with order-header information, linked to a sub-report showing order-details.
Create a new report based on the table with order-header data and Group the data on order-number.
Create a second Detail section, the report now shows ‘Details-A’ and ‘Details-B’
Add a ‘Function field’ to the ‘Details - A’ section. The function will define a global variable named
“iOrder” that gets the value of the current order-number:
dim iOrder as global
let iOrder = {Orderhea.Order_Number}
return iOrder
Hide section ‘Details -A’. We do this because the result of the function is not meant to be printed in the report.
Add a sub-report by choosing 'Sub-report' from the 'Insert' menu and place it in section 'Details – B'. The ‘Report Creation Wizard’ is activated for creating the sub-report.
Select the appropriate order-detail fields (no grouping and filtering).
Open the sub-report by double clicking it. Add the following 'Filter Function':
dim iOrder as global
return ({OrderDtl.Order_Number} = iOrder)
Defining the global variable iOrder in the filter function is optional here, because it is already defined in the main report, but it is good practice to leave it in for documentation purposes. The filter process will now only use those order-detail records that belong to the current order record that was set in the main report.
8. The Format menu
Items in the ‘Format’ menu are for changing the visual representation of objects. For most options, a comparable button is placed on the button bar.
8.1 Font
The menu option 'Font' contains a sub-menu in which you can choose to make the field's font bold, italic or underlined or to increase or decrease the font size. All five options also have a button in the tool-bar to accomplish the same goal.
8.2 Lock size/position
With this menu option – also available as tool-bar button – you can lock the size and position of the object. This means you cannot move the field with the mouse or cursor keys. The chosen state is saved for the object in the report.
8.3 Suppress field
This option can be selected to suppress a selected field. The option is also available via a tool-bar button.
Remember that to conditionally suppress an object you can write a function via the field properties dialog.
8.4 Field properties
Depending on the type of object that is selected, the panel to change settings will have different tab pages.
8.4.1 Common
The first input field allows the name of the object to be changed. The name of the object does not need to be unique.
If the object refers to a function the name of the function and the name of the object might be different and it is up to you to decide whether you want to keep them in sync or not.
The second input field allows for adding a tooltip text. A tooltip is the text that will be visible when hovering over the object with the mouse cursor.
A value is not required.
With the next four input controls you can change the size and/or location of an object. The value is internally stored in TWIPS which means that the shown value later is most likely to be slightly different due to rounding.
The data in an object can be shown as aligned to the left, to the right or in the center. The setting can be specified via the combo-form or via the result of a function. An example of a function to align the field is:
if ({OrderHea.Order_Number} < 150) then return drHorzAlignmentLeft
else
return drHorzAlignmentRight end
By checking the checkbox ‘Suppress’, the object can be hidden in the report. Suppression can be conditionally realized by using a function. Click the button on the right-side and enter a function. An example of a function on how to suppress a field:
if ({OrderDtl.Qty_Ordered} = 0) then return true
else
return false end
Checking the ‘Lock Position and Size’ option locks the object so that size and location cannot be changed until the object is unlocked again.
8.4.2 HTML
The ‘HTML’ tab page contains options that are specific for HTML output of reports.
‘Hyperlink id’ is meant for integration. Setting this value will create a DIV element when HTML output is chosen.
For further information on integration refer to the ‘DataFlex Reports Developer Guide’.
8.4.3 Border
On the ‘Border’ tab page the settings of the object border can be changed. This tab page is not available for all objects.
The available settings of border line styles are:
A border-line style can be conditionally defined, using a function. Click the button on the right-hand side to add apply a function.
An example of using a function to define a border:
if ({OrderDtl.Qty_Ordered} < 1) then return drBorderSingle
else
return drBorderNone end
Pick one of the predefined colors from the drop-down or select a custom color from the RGB color range to set the color of the borders.
Setting the color can also be done by using a function. Click the button to add a function.
An example of a function or setting a color:
if ({OrderDtl.Qty_Ordered} < 1) then return (drRed)
else
return (drBlack) end
The background color can be set in the following styles:
Solid (drSolidGradient)
Horizontal (drHorizontalGradient)
Vertical (drVerticalGradient)
Setting the gradient style can also be done by using a function. Click the button to add a function.
An example of a function or setting a gradient style:
if ({OrderDtl.Qty_Ordered} < 1) then return (drSolid)
else
return (drHorizontalGradient) end
Pick one of the predefined colors from the drop-down or select a custom color from the RGB color range to set the color of the background. When the background-style is set to ‘Solid’ only the primary color is used. When a gradient is selected the ‘End color’ defines the color on the right or bottom of the gradient. Setting the colors can also be done by using a function. See the example above.
The bottom of the panel presents a preview sample of the result.
8.4.4 Font
The ‘Font’ tab page contains settings that control fonts: Size, color and styles. This tab page is not available for all objects.
The first three combo boxes in the panel are for defining the font, size and color.
The font, the size and the color of the font can be defined conditionally by using a function.
An example of changing font settings:
if ({OrderDtl.Qty_Ordered} < 1) then return ("Courier")
else
return ("Verdana") end
Note: make sure the named font is available on your development and/or the deployment machine.
For the styles, checkboxes can be used to display the font as ‘Bold’, ‘Italic’, ‘Underline’, and/or ‘Strikethrough’.
These setting can be conditionally defined by using a function as well.
An example of using a function for setting the font style:
if ({OrderDtl.Qty_Ordered} < 1) then return (true)
else
return (false) end
The bottom of the panel shows an example of the result.
8.4.5 Text field
If the field contains text (character strings or textbox objects) the field properties dialog contains a tab-page for text related settings.
With the first combo-form you can change the
With the first combo-form you can change the