Link to home
Start Free TrialLog in
Avatar of appelonia21
appelonia21

asked on

Foxpro - Searching for numbers in separate column

Here is my issue:  I have a dbf table with following fields:
Part Number               Orig Information
123                                Seat, 123, Viton
456                                Seat, 04567, Viton

I am trying to flag a field when the Part Number (123) is identified in the original field so that I can easily find items that need to be corrected.  The 456 is incorrectly entered into the Part Number field, it should be 04567 but I need to identify the ones that we need to look at.
Avatar of Ferruccio Accalai
Ferruccio Accalai
Flag of Italy image

Is the Orig Information always in that format?
If so you can do something like
select * from table1 where [part number] <> mid([Orig Information],7,instr(7,[Orig Information],",")-7)

Open in new window

Avatar of appelonia21
appelonia21

ASKER

No unfortunately it isn't.  It is a raw data field and can be in any format, I just want to be able to search within it for the match
@I just want to be able to search within it for the match

Are there any sure delimiters? If not you should create some code to check into any string to strip out the value to match

For example this query will select every record where part number is contained into Orig Information
select * from table1 where [Orig Information] LIKE "*"+[Part Number]+"*"

Open in new window

but if let's say every part number into the Orig Information is in format [space]Part No.[comma] (that is   " 04567,") then you could use a query like
select * from table1 where [Orig Information] not LIKE "* "+[Part Number]+",*"

Open in new window

The ampersand (&) is the standard Access concatenation character.  The plus (+) can be used but it handles nulls differently so unless you need the special treatment of nulls, it is best to stick with standard.
SOLUTION
Avatar of crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The only solution or help suitable for FoxPro environment is in the post https:#a41826808. It explains how to define filters on the data in question to display data which follow given filter condition.

Other answers did not reflect FoxPro environment so they cannot work.

appelonia21, if you have additional questions to this subject ask then, if not then please close the question and mark the solution.
Unfortunately, just one correct solution suitable for FoxPro was provided. Other solutions do not work correctly in FoxPro or they suppose FoxPro knows VBA etc. Assisted points were assigned for the good Access solution.