Home > SI5 Documentation > User Guide > Reports > Tips and Tricks > Metric Report Dimensions

Metric Report Dimensions

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

  1. Open the custom report in the Report Designer
  2. Select the Script tab at the bottom of the designer
  3. 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

  1. 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.

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

  1. Go back to the Designer tab
  2. 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

How to use the new metric data fields

  1. Save and publish the report

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

 

 

 

You must to post a comment.
Last modified
16:02, 26 Nov 2013

Tags

This page has no custom tags.

Classifications

This page has no classifications.