User thorinek ( posted:

This is not the fastest or most elegant method, but Rational provided us
with an 'undocumented' and 'unsupported' feature in Robot which allows you
to dump data from an Object Verification point to a variable array. We
are just beginning to play with this feature (it's slow - gridVP x2).

Although it seems to have significant possibilities, we have yet to use it
much due to speed and maintenance issues. By sharing it at this stage of
development, maybe there are others out there who could assist in cleaning
up the code, and speeding up the process?

' "TestScript.REC" Sample code ***************************************

Declare Function GetData(ScriptName As String,VPName As String, data() As
String) As
Declare Function CountColumns(strStringToSearch As String) As Integer
Sub Main()

Dim MyData() As String
Dim Result As Integer

'Need to create your application VP here to have Robot collect the
' Result = GenericObjectVP
(CompareData, "Class=AfxOleControl;ClassIndex=1", "VP=MyVP")

' Then call function to GetData from the VP into Array
Call GetData ("TestScript", "MyVP", MyData())

End Sub
'************************************************* ***************************

' GetData - This function will allow you to get the information stored
in a
ListView Control.
' It requires you to create an object data verification point
before you
call the
' function. You then pass the function the name of the script,
the name
of the verification
' point and an empty array of strings. It will return 0 if it
successful or -1 if it was
' unsuccessful. Within this function, it also calls another
'************************************************* ***************************

Function GetData(ScriptName As String,VPName As String, data() As String)
As Integer

Dim vpPath As String
Dim fname As String
Dim x As Integer
Dim NumColumns as Integer
Dim NumRows as integer
Dim nStart as Integer
Dim nEnd as Integer
Dim Counter as Integer
Dim Lines() as string
NumRows = 0
vpPath = SQAGetLogDir

redim Lines(10)
fname = dir(vpPath & "vp\" & ScriptName & "."
& VPName & ".act*.grd")
If fname = "" Then fname = dir(vpPath & "vp\" &
ScriptName & "." & VPName
& ".exp.grd")
if fname = "" then
GetData = -1
Exit function
End if
open vpPath & "vp\" & fname for input as #1
Line Input #1, Lines(NumRows)
Do while not eof(1)
if Ubound(Lines) = NumRows then redim preserve Lines(NumRows + 10)
NumRows = NumRows + 1
Line Input #1, Lines(NumRows)
Close #1

if ( NumRows < 1 ) then
GetData = -1
Exit Function
end if

NumColumns = CountColumns(Lines(0))
ReDim data(NumRows-1,NumColumns-1)

for x = 0 to NumRows-1
nStart = 1
Counter = 0
Do While nStart < Len(Lines(x))
nEnd = Instr(nStart,Lines(x),chr$(9))
If nEnd = 0 then
nEnd = Len(Lines(x))+1
End if
Data(x,Counter) = Mid(Lines(x),nStart,nEnd-nStart)
nStart = nEnd + 1
Counter = Counter + 1
next x

' success!
GetData = 0
End function
'************************************************* ***************************

'This function requires you to pass it the string you are searching
'It searches that string for the Tab Character (In ASCII, Tab is
represented by 9)
'Returns the count
'************************************************* ***************************

Function CountColumns(strStringToSearch As String) As Integer
Dim nStart as Integer
Dim nCount as Integer
nCount = 0
nStart = 1
Do While nStart <> 0
nStart = Instr(nStart + 1,strStringToSearch,chr$(9),0)
nCount = nCount + 1
CountColumns = nCount+1

End Function