View Single Post
  #9 (permalink)  
Old January 12th, 2007, 11:05 AM
johnslaughter johnslaughter is offline
Registered User
 
Join Date: Jan 2007
Location: overland park, ks, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is the table that I am building. Note that the names of the columns are the same as the ScreenLocation record sets in the table that I am reading.

RecordTable
RecordName Field1 Field2 Field3 field4
 123-456789



This is the table I loop through to gather information for my record set “123-456789”
LoopTable
ScreenLocation row column length
Field1 1 1 15
Field2 2 1 20
Field3 2 25 5
field4 5 10 10

The first thing I do is add a record (123-456789) to my RecordTable. I then start my loop and find the information that needs to go ino Field1 for record "123-456789". On the first loop the variable HoldField is going to equal “Field1”. That value is the same name as the second column in RecordTable (Field1). The second loop through HoldField = Field2, which is the name of the third column in RecordTable. As I loop through the LoopTableI will now have the names of every column in RecordTable . I would like just a few lines of code that can use the value of “HoldField” each time it loops through the table and update the RecordTable so I don’t have to write separate code to update each column. Also if a “Field5” is added to the screen I am scraping, I just need to add a row (Field5) to LoopTable and a new column to RecordTable. The same if the location to Field2 changes. I just update the numbers in row, column or length. In both cases I did not have to revisit the code to update the changes to the screen.

Something like:
    RecordTable![“HoldField”] = ScreenInfo

I do not want to write the same code 50 times to update each column for therecord set 123-456789
    RecordTable!Field1 = ScreenInfo
    RecordTable!Field2 = ScreenInfo
    RecordTable!Field3 = ScreenInfo
    RecordTable!Field4 = ScreenInfo

RecordTable.AddNew
RecordTable!RecordName = “123-456789”
RecordTable.Update

Do While Not LoopTable.EOF
    HoldField = LoopTable!Screen!Location
    HoldRow = LoopTable!row
    HoldCol = LoopTable!column
    HoldLng = LoopTable!Length

    ScreenInfo = PcControl.GetText(HoldRow, HoldCol, HoldLng)

Edit Record “123-456789”
    RecordTable![“HoldField”] = ScreenInfo
Update

Loop




Reply With Quote