Clipper programming language
Command Needed
Posts  1 - 1  of  1
marge0512
Hello, I need a command that works like the "Like" command in SQL. Our system was programmed in Clipper87 and we have to type in the exact company name using hyphens and everything else. If you don't type the name in the exact way, you would get Record Not Found.

For example,searching for "The Burling - Huntor Store" would have to be typed in that exact way in order to find that record. Is there a way that i could just type in "The Bur" and it would find it?? I would also like to have all records to sort from "The Bur" so the user may easily select the row.

I hope I'm explaining this in a way that is understandable.

This is what I have now:

procedure REC_FND
private REC2FIND, SAV_REC
* Save current position in database if search fails
*--------------------------------------------------
SAV_REC = recno()

set color to &GET_CLR
read

* Continue if escape wasn't pressed
*----------------------------------
if LASTKEY()#ESC_KEY

*--------------------------------
REC2FIND = space(40)
do DISP_MSG with 'Client (include punctuation): '
@row(),col() get REC2FIND
read

* Continue if the escape key was not pressed
*-------------------------------------------
if lastkey() # ESC_KEY

* Remove trailing spaces
*-----------------------
REC2FIND = upper(trim(REC2FIND))

* Get client index
*--------------------
set order to 7

* Search using the key
*---------------------
set exact off
seek REC2FIND
set exact on

* Return to the first index
*--------------------------
set order to 1

* If found, put the highlight bar on the record
*----------------------------------------------
if !eof()
do SCRL_TOS
* If not found, tell the user
*----------------------------
else
do DISP_MSG with [Client, ]+trim(REC2FIND)+[, not found. Press a key.]
inkey(0)
go SAV_REC
endif
endif

endif

return

Thanks in advance!
Save
Cancel
Reply
 
x
OK