The ReportData object lets you access data sent to reports during the EventReportData event.
This event can only be accessed inside the Properties dialog box inside the Label and Report Template Editors inside PC-DMIS versions 4.0 and higher.
Properties dialog box
Using this object in conjunction with the EventReportData event, you can access the desired information.
Suppose in PC-DMIS's Label Template Editor, you use a Border object to change its background color to match the current dimension out of tolerance color. You can do this using the ReportData object. The following code works inside of the PC-DMIS's label template editor in the EventReportData event of a Border object.
Dim Count As Integer
Dim i As Integer
Dim MaxIndex As Integer
Dim MaxDev As Double
Dim CurrentDev as Variant
Dim Dev as Variant
Dim PTol as Variant
Dim MTol as Variant
Dim DevColor as Long
' Initialize Max Deviation and Max Index
MaxDev = 0.0
MaxIndex = 1
'Get the number of axes for this dimension
Count = ReportData.GetCount(132)
'Adjust the bottom of the border to fit the number of axes
Border1.Bottom = 106+((Count-1)*25)
'Loop through to find the largest deviation
'When loop is complete, MaxIndex is the index to the
' largest deviation
For i=1 to Count
CurrentDev = ABS(ReportData.GetValue(DIM_DEVIATION,i))
If CurrentDev > MaxDev Then
MaxDev = CurrentDev
MaxIndex = i
End If
Next i
' Using MaxIndex, acquire the axis's deviation +TOL and -TOL
Dev = ReportData.GetValue(340, MaxIndex)
PTol = ReportData.GetValue(167, MaxIndex)
MTol = ReportData.GetValue(168, MaxIndex)
' Use this information to adjust the background color of the border
DevColor = ReportData.GetTolColor(Dev,PTol,MTol)
Border1.BackColor = DevColor
Border1.ForeColor = DevColor