Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LIKE operator and search phone without area code
Message
 
 
To
21/10/2005 11:18:54
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01061088
Message ID:
01061098
Views:
11
I thought about it, but could not find LIKE operator in HELP.

>>Hi everybody,
>>
>>In HELP I could not find LIKE operator. I see LIKE() function definition.
>>
>>I want to be able to search by phones without area code. I have field as cArea_Code+cExchange+cLast_Four.
>>
>>Here is my code:
>>
>>*---------------------- Location Section ------------------------
>>*   Library: 	Asearchcontrols.vcx
>>*   Class: 		Cntphonesearch
>>*   Method: 	Getwhereexpression()
>>*----------------------- Usage Section --------------------------
>>*)  Description:
>>*)
>>
>>*   Scope:      Public
>>*   Parameters:
>>*$  Usage:
>>*$
>>*   Returns:
>>*--------------------- Maintenance Section ----------------------
>>*   Change Log:
>>*       CREATED 	08/12/2005 - NN
>>*		MODIFIED
>>*----------------------------------------------------------------
>>LOCAL lcRetVal
>>lcRetVal = ""
>>DO case
>>	case NOT EMPTY(this.txtAreaCode.Value) AND NOT EMPTY(this.txtExchange.Value) AND NOT EMPTY(this.txtLastFour.Value)
>>		lcRetVal = SUBSTR(STRTRAN(this.cSeparator + this.cFldname, this.cSeparator, "+##ALIAS##."),2) ;
>>           + " LIKE '" + this.txtAreaCode.Value + this.txtExchange.Value + ;
>>           this.txtLastFour.Value  + "%'"
>>    case EMPTY(this.txtAreaCode.Value) AND NOT EMPTY(this.txtExchange.Value) AND NOT EMPTY(this.txtLastFour.Value)
>>		lcRetVal = SUBSTR(STRTRAN(this.cSeparator + this.cFldname, this.cSeparator, "+##ALIAS##."),2) ;
>>           + " LIKE '???" + this.txtExchange.Value + ;
>>           this.txtLastFour.Value  + "%'"
>>ENDCASE
>>
>>this.cWhereExp = STRTRAN(m.lcRetVal, "##ALIAS##", this.cAliasname)
>>
>>RETURN m.lcRetVal
>>
>>
>>If I put area code, it works. Without area code it immediately produces no records found message. What is wrong here? Can I combine ??? and % in one string?
>
>
>N,
>
>The ? for the sql LIKE is _ (underscore)
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform