SET SAFETY OFF lc_sono = ' 67' lc_item = 'QAD3672 ' lc_loctid = 'WH1 ' ln_lineno = 1 CLOSE DATA ALL SELECT 0 CREATE TABLE delme1 (custno C(10), sono C(10), lineno N(4,0)) *-- Add in a bunch of data FOR ln_cntr = 65 TO 75 FOR i = 1 TO 15 INSERT INTO delme1 (custno, sono, lineno) ; VALUES (REPLICATE(CHR(ln_cntr), 4), PADL(ln_cntr, 10), i) ENDFOR ENDFOR *-- Create the index INDEX ON DELETED() TAG DELFLAG INDEX ON custno TAG custno INDEX ON sono TAG sono INDEX ON custno + sono TAG custno1 INDEX ON sono + STR(lineno, 4) TAG sono1 USE USE delme1 ALIAS a_delme1 SET ORDER TO custno1 SELECT 0 CREATE TABLE delme2 (item C(15), loctid C(6)) INSERT INTO delme2 (item, loctid) VALUES (lc_item, lc_loctid) INDEX ON DELETED() TAG DELFLAG INDEX ON item TAG item INDEX ON loctid TAG loctid INDEX ON item + loctid TAG item1 INDEX ON loctid + item TAG loctid1 USE USE delme2 ALIAS a_delme2 SET ORDER TO item1 SELECT 0 CREATE TABLE delme3 (item C(15)) INSERT INTO delme3 (item) VALUES (lc_item) INDEX ON DELETED() TAG DELFLAG INDEX ON ITEM TAG item USE USE delme3 ALIAS a_delme3 SET ORDER TO ITEM SELECT 0 CREATE TABLE delme4 (loctid C(6)) INSERT INTO delme4 (loctid) VALUES (lc_loctid) INDEX ON DELETED() TAG DELFLAG INDEX ON loctid TAG loctid USE USE delme4 ALIAS a_delme4 SET FILTER TO NOT DELETED() SET ORDER TO TAG loctid IN a_delme4 SELECT a_delme2 SET ORDER TO TAG item1 IN a_delme2 *-- Set relations SET RELATION TO item INTO a_delme3, loctid INTO a_delme4 ln_area = SELECT() SELECT a_delme2 lc_order = ORDER("a_delme2") SET ORDER TO TAG item1 IN a_delme2 SEEK lc_item + lc_loctid ? SEEK(lc_sono + STR(ln_lineno, 4), 'a_delme1', 'sono1') && returns .f. ? SEEK(lc_sono + STR(ln_lineno, 4), 'a_delme1', 'sono1') && returns .t.