Showing dimensions in metric units on custom reports
Overview
Due to a bug in SI5, product dimensions (height, width, depth) always appear in imperial/US units on reports. This posting discusses how to modify a custom report to show dimensions in metric units.
Steps to modify custom report
- Open the custom report in the Report Designer
-
Select the Script tab at the bottom of the designer
-
Add three lines of code to the ActiveReport_DataInitialize event. This will create three new data fields:
Sub ActiveReport_DataInitialize
Rpt.Fields.Add(“Height_Metric”)
Rpt.Fields.Add(“Width_Metric”)
Rpt.Fields.Add(“Depth_Metric”)
End Sub
- Add the lines of code below to the ActiveReport_FetchData event. This will calculate the metric values (centimeters) and store them in the new data fields.
- Go back to the Designer tab
- In any textbox where you wish to see one of these data fields, set the DataField property of the textbox to be equal to the name of the new data field (e.g. “Depth_Metric”)

How to use the new metric data fields
- Save and publish the report
Function ActiveReport_FetchData(ByVal EOF As Boolean) As Boolean
Dim itm As DTools.SystemIntegrator.Reporting.Item = ReportUtilities.ReturnItem(rpt)
Const Factor = 2.54 ‘conversion factor: inches to centimeters
If itm IsNot Nothing Then
Rpt.Fields(“Height_Metric”).Value = itm.Height * Factor
Rpt.Fields(“Width_Metric”).Value = itm.Width * Factor
Rpt.Fields(“Depth_Metric”).Value = itm.Depth * Factor
End If
ActiveReport_FetchData = EOF
End Function
Additional Information
See the attached custom report for a sample of how this works in practice.
Download report by clicking here: Line Item Metric Dimensions
Also, see this document for generic instructions on how to add a calculated field to a report: http://downloads.d-tools.com/si5/reports/Docs/Adding_Calculated_Fields_To_A_Report.zip
Popularity: 19% [?]

