Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

last column position

Status
Not open for further replies.

vzachin

Technical User
Feb 10, 2006
305
US
i have various tables with various columns.
i need to find the beginning position for the last column in my table.

my data always begins in Row 9,Col 14 to Row 9,Col 73.


Code:
Sub TestLastCol()
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System")
Set Sessions = System.Sessions
Dim Sess0 As Object
Set Sess0 = System.ActiveSession

For y = 14 To 73
DataField = Trim(Sess0.Screen.GetString(9, y, 13))
Next y

End Sub

i was thinking of testing each field by beginning in the last column 73 and testing backwards.

if 9,73 has a value, then continue testing each previous column field until the next blank column.

if 9,73 is blank, then continue testing each previous column field until a column has a value, and then continue until the next blank column.

then the blank column + 1 will be the last column. correct?

how can i test backwards? or is there an easier method?

thanks
zach
 




Hi,

Your Extra Object interface is going to be slower than VB. So my approch in almost every case is the scrape the screen in one fell swoop, and then process that string in a loop with the MID function.

So, since you are only interested in row 9 and nothing else, just grab that row...
Code:
sData = Sess0.Screen.Area(9, 1, 9, 80)).Value
For y = 14 To 73
  DataField = Mid(sData, y, 1)
Next y
I don't get what you are doing looking at column 14 for a length of 13, then column 15 for a length of 13, etc., with
Code:
GetString(9, y, 13))
Do you have 13 byte LOGICAL columns, starting at COLUMN 14 (the fourteenth byte in row 9???) ie data in...
[tt]
14 27 40 53 66
[/tt]
Please explain.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a brand NUANCE![tongue][/sub]
 
hi skip,
thanks for the reply.
i have it all worked out now. and i see what you mean about scraping the one row first

that was a typo.
Code:
GetString(9, y, 13))

thanks
zach
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top