Solved

FoxPro comparing columns

Posted on 2016-10-29
2
78 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
not sure how to proceed 6 421
Foxpro, Word 2003 Automation and Windows 7 10 889
VFP - Parameterised Views - "sql: where clause is invalid" - Why? 26 372
Foxpro errors 4 28
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…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

805 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