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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selected marking of target 1

gbcpastor

Programmer
Jun 12, 2010
79
US
I need to mark the first 3 records in a field called TARGET when the field called MAILCODE contains "123ABC"

Then repeat the process for each value in the MAILCODE field.

Please help!
 
First threee of a group of the same mailcode, I assume. Then by which order, first three requires an order to tell what's the first three in some specific order.

If you mean by physical order, then the straight forward xbase code would be

Code:
* determine all unique mailcodes

SELECT DISTINCT MAILCODE as mailcode from yourtable INTO CURSOR mailcodes
* go through each of them
SELECT yourtable
SET ORDER TO mailcode

SELECT mailcodes
SCAN
   SELECT yourtable
   SET KEY TO mailcodes.mailcode
   SCAN NEXT 3
      *do whatever - mark records as found/relevant, process them
   ENDSCAN
ENDSCAN
 
First threee of a group of the same mailcode, I assume. Then by which order, first three requires an order to tell what's the first three in some specific order.

If you mean by physical order, then the straight forward xbase code would be

Code:
* determine all unique mailcodes

SELECT DISTINCT MAILCODE as mailcode from yourtable INTO CURSOR mailcodes
* go through each of them
SELECT yourtable
SET ORDER TO mailcode

SELECT mailcodes
SCAN
   SELECT yourtable
   SET KEY TO mailcodes.mailcode
   SCAN NEXT 3
      *do whatever - mark records as found/relevant, process them
   ENDSCAN
ENDSCAN
Perfect Chris, thank you so much for your help.
 

Part and Inventory Search

Sponsor

Back
Top