Why not have a go at your first composite report today!
In this blog, we’ll take a look at a new StormWorks function, which simplifies the creation of composite reports. So what’s a composite report I hear you ask? Very simply a composite report provides a framework that allows you to take a number of related reports and combine them into one report. This is done by creating the main report framework using the composite report type and then including other previously created reports within. These included reports are then known as sub‑reports. This simple feature allows you to build very sophisticated reports in the Entuity Report Builder. Take a look at the example to the below.
Example Device Detail Report
In the example Device Detail Report, the first section is a sub‑report containing device information. We’ve selected the device’s model, serial number and firmware version amongst other things. The next sub-report provides port summary information. These ports belong to the device in the sub‑report above, as you might expect. In the third sub-report, we’ve selectively included charts showing port traffic rate. Whether or not to include a particular chart is done at report run time based on whether the data is interesting or not. In this case, the chart is only included if the Standard Deviation is higher than 1.
The Sub-Report Challenge
Creating reports like this is all something you’ve been able to do since Entuity 14.5 but it needs a bit of work to achieve. To understand the port selection problem let’s have a look at how this works in our example:
- The main report will iterate through the selected devices one at a time.
- For each device, it will pass the StormWorks ID of the current device to its sub‑reports and run them.
This will work just fine for the first sub‑report in our example as it’s a device based report and so will know what to do with a device ID. This will not work for the second two sub-reports. This is because they’re port based reports and don’t know about device IDs, so you’ll end up with a blank sub-report. So we need to change this default behaviour so that the main report supplies port IDs to the port based sub‑reports. So let’s take a look at the composite report definition to see how this is done.
Composite Report Definition
Notice, under “Hidden Property Fields” an extra property called portServerObjectIds has been created and the parameters of the two port based sub‑reports have been overridden.
We can take a look at the definition of the portServerObjectIds property field, by clicking its value (portServerObjectIds) and then by editing the attribute, we can see the StormWorks expression that returns the port IDs we need. We’ll look at how this expression works in a moment
Next by clicking the overridden parameter set for one of the port based sub‑reports we can see that the portServerObjectIds property field we were just looking at has been used to override the serverObjectIds parameter. Both sub-reports are set up in the same way.
How the Code Works
So let’s have a look at how this expression works. The new function takes a single argument, which is the list of objects we want to be included in the sub-report. The output is a correctly formatted comma separated string of server/object IDs suitable for the sub-report. In our example, we need a list of port objects that belong to the current device. This can be achieved with the statement ref.ports, which will return a list of port objects when in the context of a device. We can see how this works in the debug agent.
(Cacheable(0x8002=CT_OBJECTINSTANCE,809), Cacheable(0x8002=CT_OBJECTINSTANCE,810), Cacheable(0x8002=CT_OBJECTINSTANCE,811), Cacheable(0x8002=CT_OBJECTINSTANCE,812), Cacheable(0x8002=CT_OBJECTINSTANCE,813), Cacheable(0x8002=CT_OBJECTINSTANCE,814), Cacheable(0x8002=CT_OBJECTINSTANCE,815), Cacheable(0x8002=CT_OBJECTINSTANCE,816), Cacheable(0x8002=CT_OBJECTINSTANCE,817), Cacheable(0x8002=CT_OBJECTINSTANCE,818))
First, we set the current context to a device. In this example, the device has the StormWorks ID of 730. Then we get our list of ports. Note that “simple;” just specifies that we want to use the simple syntax rather than the native syntax, which is rarely used today.
If we then feed this information into the new function, we get server_object_id_string (ref.ports). In the debug agent it would look like this:
Note that when we use the expression in the report, we do not need to specify the simple syntax as this is expected.
I hope you’ve enjoyed this little taster of what is possible with some of the more advanced features of the report builder. If you would like to know more please contact your account manager, who will be able to supply details of the Entuity Report Builder training course.
Have a look at our Reporting and Dashboard Features Page for more information around Entuity’s reporting capabilities.