Using the Report Designer Display
Report Items can be added to the Report Designer Display where the layout and content of your report can be configured. Right-click on the Test Report created in the last section and select Add item to… > Report Designer from the context menu (shortcut Ctrl+O). This opens the Report Designer workspace with the Properties panel open on the right. Click on the Dictionary tab at the bottom of the Properties panel.
In the Dictionary tab under Data Sources, there should be a data set visible (the name should match the DataSet Name property of the Report Item). If there is no data set visible, it may be necessary to re-execute the Lua script in the Report Item.
Expand the ds data set. If you added all the Query Options from the previous section the Dictionary should look similar to the screenshot shown below.
Each of the different configured query options (Realtime, Namespace and History) is represented by two tables in the Dictionary:
The first table contains static property data (the _items table for the Realtime and History Query Options, the _properties table for the Namespace Query Option).
The second table contains dynamic property data (the_data table for the Realtime and History Query Options, the _instances for table the Namespace Query Option).
To view the content of a table, right-click on it and choose View Data… from the context menu. This opens up a table dialog showing all the data in the selected table.
Property data from any table can be added to reports by dragging and dropping into Bands that are added to the display workspace (this is explained in the next section). The dynamic property data is updated from the Query Objects when the report is viewed at Run Time.
Also available in the Dictionary Panel are the System Variables. These includes various variables that are related to the report in general (for example the report name, the current time and date) without querying objects in the namespace.
The ReportName system variable is taken from the Report Design Data properties of the Report Item where the Report Layout is saved. Changing the Report Name in the Object Properties panel of the Report Item (and clicking Apply) changes the ReportName in the Report Designer Display.
Also available in the Dictionary are a series of predefined functions that can be used to display calculated data values. For example, counting the number of items in a data band or the time span between two dates.
The report layout is made up of bands that are added to the Report Designer workspace by clicking on the "Bands" icon on the left hand side of the workspace. In this example we will use the "Report Title", "Group Header" and "Group Footer" bands and, most importantly the "Data" band. Click on the "Bands" icon to open the menu.
Select "Report Title" from the list of options. The cursor changes to a pencil icon and you can click in the report workspace to add the band or drag and resize the band to the desired size (the band will automatically fill the width of the workspace page).By clicking on the icons in the bar to the left of the workspace window you can now add items to the Title band report such as text, shapes and images. We will first add the Report Name from the Dictionary tab in the right hand panel by expanding the "System Variables" tree. Click on "ReportName" from the list and drag it into the title band.
The "ReportName" variable takes its content from the Report Design Data, Report Name property of the Report Item object. When a Report Item object is added to the Report Designer display, a Report Design Data entry is automatically created to store the design layout (as an XML file in Report Design). It is automatically given the name "Report" but you can change this in the Object Properties panel and it will be reflected in the "ReportName" system variable.
|Be sure to save the report layout in the Report Designer first before making any changes in the Report Item Object Properties panel, otherwise the Report Design layout will be lost. A warning will be displayed when you apply any changes to the Report Item object.|
The ReportName properties (font, text size, alignment, colour etc.) can be changed by selecting it in the workspace and clicking on the Properties tab of the right hand panel. Change the title properties to your liking and make sure to resize the text box to accommodate any changes.
Properties panel in the Report Designer workspace
The data fields that we will add from the Query Option Objects should be added to a Data Band. It is useful to "group" the Data Band using Group Header and Footer Bands so you can separate objects or keep them in the same group. Much more information on grouping data can be found in the Stimulsoft Reports documentation. To begin the grouping, add a "Group Header" band to the report by clicking on the "Bands" icon and selecting "Group Header". When the pencil cursor is displayed, click in the Report Designer workspace and the Group dialog will be displayed. The data sets from the Dictionary panel will be displayed and you can choose how to group your data. We will begin by creating a group associated with the Realtime Query object data, so open the Temperature_rt_items table and select ObjectName.
Assigning the group in this way means all query objects in this Realtime Query Option will be grouped together. If you added another query object to the Realtime Query Option (through the table properties dialog in the object properties panel of the Report Item) it will appear in this group. To separate the items in the same Query Option you can assign the group to the ObjectName property in the Temperature_rt_data /_items subtable.
To add a label to the group heading click on the "Components" icon in the left-hand item list and select "Text". The pencil cursor will be displayed and you can click in the group header to add a text label in the Text dialog box.
Adjust the size of the text box and change the text style using the Properties panel. You can also change the colour and style of the Group Header band in the Properties panel to make the group distinctive in the report.
Next we will add the Data band where the data from the Query objects is displayed. To do this click on the "Bands" icon and select "Data". With the pencil icon, click below the Group Header band in the workspace to add the data band. This will bring up the Data band assignment dialog where you can select the Temperature_rt_data table for the data band. Click OK to assign the data band.
Now add some property data items from the Temperature_rt_data table in the Dictionary panel into the data band by drag and drop. In the below example the ObjectName (from the rt_items subtable), the Value and the Timestamp have been added.
This group can now be closed by adding a Group Footer Band from the "Bands" menu and adding it to the reoprt design. Change the colour of the Group Footer band in the Properties panel so the group is clear in your report. When finished, the workspace should look something like below.
Save the report design layout and then click the Preview Tab to view the report design.
More Query Objects can easily be added to the the report by opening the Query objects table in the Realtime Query option of the Report Item, adding a row to the tabel and dragging and dropping another object from the I/O model:
Click Apply in the object properties panel of the Report Item (this change will prompt a dialog saying that the object has been changed and needs to be reloaded, click Ok). Reopen the Preview in Report Designer and the Grouped Data band will be updated with the new query object.
|The object is reloaded when the Report Item properties are changed and applied (in this case, when the second query object was added to the Realtime Query Option). Upon reloading, the Lua script is re-executed and once again, retrieves properties from the configured query options. When this happens, during Design Time, the object’s dynamic property values, at the time of the object reloading, will be updated and displayed in the report preview. This is different however, to the report creation at Run Time, when the Report Item is triggered to execute the script to retrieve dynamic property data.|
We will next create a chart in the Report using the History Query data. This example will only cover the basics of creating a chart in Report Designer. For more detailed examples and a full range of configuration options, please visit the Stimulsoft Reports documentation. For this simple example we will not group the data but will need to add a "Data" band to the Report layout to contain the Chart. Select a Data band from the "Bands" menu on the left and add it to the workspace with the pencil cursor. When the Data Assignment dialog pops up, assign the Data band to the TempertureHistory_ht_items table and click OK.
Expand the size of the Data band using the resize arrows then locate the "Infographics" icon in the left hand menu bar. Click on the icon and select Line > Line from the options.
Add the chart to the data band, and drag it to the desired size.
This will open the Chart Editor dialog where the chart settings can be configured.
The "Series" options are configured first. In the Properties panel on the right the following basic chart options can be configured:
the y-values source (section 1. Value)
the x-values source (section 2. Arguments
Series labels (section 4. Common)
Click on the drop-down arrow next to Value Date Column to bring up the Dictionary. Under Temperature History_ht_data table, doule-click on the Value column.
Select the Argument Data Column in a similar way but this time under Temperature History_ht_data table, doule-click on the Timestamp column. In the Common properties section, select the Title property to open up the displayed series tiltle text editor. Delete 'Series 1' and then drag and drop the ObjectName column from the Dictionary TemperatureHistory_ht_items table into the Text Field. Click OK.
Set the Format property in the Common section to : N2 This will set all numbers in the chart to display 2 decimal places. The properties panel should look like below:
Click on the "Area" tab in the Chart Editor to format labels and titles of the x and y axes of the chart.
Click on "X Axis" in the middle set of options to open the properties for the x axis. Expand the "Labels" and "Title" sections.
Under "Labels", set the Angle property to 45
Under "Title", set the Text property to Timestamp
Click on "Y Axis" and in the Title section, enter the Text property as Temperature / C.
Once finished, click OK to close the Chart Editor and return to the Report Display. Save the report layout before continuing, It should look something like the screenshot shown below.
Click on Preview to see how your Report layout will look.
This is a very simple example of how to add a chart to the report layout, there are lots of different chart and configuration options that can be applied. For more detailed examples and a full range of configuration options, please visit the Stimulsoft Reports documentation.