Solved

FoxPro comparing columns

Posted on 2016-10-29
2
25 Views
Last Modified: 2016-11-02
I am looking for a command that will compare two columns and flag for deletion items where similar words exist between the two.  Here is an example:

MFG1                                                        MFG2
USA BLUE BOOK APPROVED                USA BLUE BOOK
FRIO TEMP LAB                                       USA BLUE BOOK
CORNING                                                 USA BLUE BOOK

In these examples the command would flag the first row because the same words appear in both MFG columns.

Thank you,
0
Comment
Question by:appelonia21
2 Comments
 
LVL 41

Accepted Solution

by:
pcelba earned 500 total points
ID: 41865321
You must define exactly what means "the same words appear in both MFG columns". Is the word order significant?

Your example just shows the shorter text is equal to the beginning of the longer text but that's not sufficient definition most probably but to provide a command which will solve it is possible, of course.

The following command will mark all such records for deletion:

SET EXACT OFF
DELETE FOR TRIM(mfg1) = TRIM(mfg2) OR TRIM(mfg2) = TRIM(mfg1)

You could also check whether the shorter text is contained inside the longer text at any position:

DELETE FOR TRIM(mfg1) $ mfg2 OR TRIM(mfg2) $ mfg1  

If you issue
SET COLLATE TO "GENERAL"
then the comparison will be case insensitive.

All above commands do not care about words they compare text strings so  FOX  =  FOXPRO.
If you need to compare whole words then let us know.
0
 
LVL 12

Expert Comment

by:jrbbldr
ID: 41870340
Pavel is correct in that we can only guess what you mean when you say:
the same words appear in both MFG columns

How many of the "same words"?
* 1 word existing in both columns?
* A 2 sequential word phrase in common?
* The entire phrase from one column in the other column?
* Or what?

Or even more un-certain:
similar words exist between the two

How are "similar words" determined?
* Same word mis-spelled?
* Words that have the same meaning?
* Or what?

Pavel has given you a suggestion for finding if the complete contents of one column are in the other column.
But that may not be what you need, depending on the specifics of what you are looking to discover.

Good Luck
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Find out what the Office 365 disclaimer function is, why you would use it and its limited ability to create Office 365 signatures.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now