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!

scanning for a record one more than one field

Status
Not open for further replies.

smartglass

IS-IT--Management
Mar 14, 2006
33
GB
Hi there:
I am trying to run a scan on a table where I need to look up the record of order number AND line in one table that matches the order number AND line in another.
All the help in scanning refers to only scanning on one field; can i scan on more than one?
Or should I be looking at a query?

Thanks!
 
Please excuse my ignorance...'and' does it!
Thanks again
 
Yes you can scan more than 1 field. There are numerous ways to best acheive this, but an example of what I believe you are looking for is below:

var
tcHandle,
tcHandle2 TCursor
endVar

tcHandle.open("mytable")
tcHandle2.open("mytable2")

scan tcHandle for tcHandle.field1 = "A" and tcHandle.field2 = "B" :

; Locate the record in another table
if tcHandle2.locate("field1", tcHandle.field1, "field2", tcHandle2.field2) then
message("Found OK")
else
message("Could not find")
endIf

endScan
tcHandle.close()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top