VB Script - End program or display error if Dim is Out of Tolerance

VB Script - End program or display error if Dim is Out of Tolerance

You can retrieve report data into VB using the “GetReportInfo()” function.

double GetReportInfo( CString sReportName, CString sReportType, int nIndex )

Return Value
The value at the specified cell of the report if the function is successful. The return value is 0.0 if there is no specified cell in the report.
Parameters
sReportName
Specifies the name of the report item to be retrieved.
sReportType
Specifies the type of report item to be retrieved. It is usually the text in the first column of the report item.
nIndex
Specifies which value of the report item to be retrieved. Defined as follows:
Nom – 1; Act – 2; Dev – 3; LoTol – 4; UpTol – 5; OutTol – 6.

i.e., the following VB Script could find out if ANY of the following dimension is Out Of Tolerance.

CODE

oot_x = GetReportInfo( "CIRCLE3", "X", 6 )
oot_y = GetReportInfo( "CIRCLE3", "Y", 6 )
oot_z = GetReportInfo( "CIRCLE3", "Z", 6 )
oot_d = GetReportInfo( "CIRCLE3", "DIA", 6 )
oot_c = GetReportInfo( "CIRCLE3", "CIR", 6 )

Now you can perform some action based on these results… Add all of the OOT variables.

CODE:

IsOut = oot_x + oot_y + oot_z + oot_d + oot_c
i.e., display a MsgBox or custom Text Message in Report



CODE:

DoPass = "Pass"
If IsOut <> 0 Then
   MsgBox("Dimension 8 Cirlce3 is OOT!!!")
   DoPass = "Fail"
End If
Or… Jump to the End of the program.

CODE:

Do
ProgEnd = MsgBox("Do you want to exit program?", 4)
If ProgEnd = 6 Then
  Exit Do
End If
Be sure to put a VB Script at the last step of the program to stop automatically.

CODE: 

ProgExit = 1
Loop Until ProgExit = 1
Attached is an example of how this can be used