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
Sub ActiveReport_DataInitialize
Rpt.Fields.Add(”Height_Metric”)
Rpt.Fields.Add(”Width_Metric”)
Rpt.Fields.Add(”Depth_Metric”)
End Sub
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
How to use the new metric data fields
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