Re: re-inventing the wheel / Tab order & Validating

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Anders Altberg (x_pragma_at_telia.com)
Date: 03/25/05


Date: Fri, 25 Mar 2005 12:41:46 +0100

SELECT DISTINCT * FROM ´MyTable INTO TABLE dupfree.
This removes whole record dupes. If you specify columns instead of * , well
you' get a dupefree version of those columns
  SELECT DISTINCT id, name, address FROM Customers ...

SELECT name, address, COUNT(*) FROM Table ;
GROUP BY 1,2 HAVING COUNT(*) > 1 ;
INTO CURSOR Xx READWRITE NOFILTER

SELECT * FROM Table T1 WHERE EXISTS ;
(SELECT * FROM Xx WHERE ;
 T1.name=Xx.name AND T1.adress=Xx.address) ;
INTO CURSOR Dupes

SELECT * FROM Table WHERE UPPER(name) LIKE 'SM_TH%'
Everyone with name like SMITH, SMITHE, SMYTHE, ...

You can use the SOUNDEX() function to pick up soundalikes.
-Anders

"steve" <steve@xircon.freeserve.co.uk> wrote in message
news:#bW1lCJMFHA.3080@TK2MSFTNGP10.phx.gbl...
> Has anyone got any code for cleaning duplicate records out of a table
> (and willing to share!!)?
>
> Save me re-inventing the wheel.
>
> I have just finished a program to help with our stocktake next week. In
> a procedural language like foxplus it would be really easy to write, but
> as I am trying to learn VFP.....
>
> I have to collect the following data:
>
> Sheet_No
> Order_No built-up from prefix, order, version, item
> customer
> Location
> Quantity
> Last_Operation
>
> I have set validation code and tab orders and added three buttons to the
> form:
>
> report+maint no tab order
> quit no tab order
> save last in tab order
>
> The thing is - if i leave my the validation code for the sheet_no text
> box the buttons on the form are not accessible, so the reports and
> maintenance button is not available until all of the textboxs are
> validated. But if I comment it out then the buttons become available.
> What am I doing wrong?
>
> E.g.
>
> thisform.prefix.valid code:
>
> Tprefix=ALLTRIM(thisform.prefix.Value)
>
> DO case
>
> CASE Tprefix="M"
> RETURN 1
>
> CASE Tprefix="W"
> RETURN 1
>
> CASE Tprefix="S"
> RETURN 1
>
> OTHERWISE
> RETURN 0
>
> ENDCASE
>
> Buttons are un-clickable at this point.
>
> THX
>
> Steve
>


Quantcast