Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function for all
Message
De
11/08/1999 04:06:40
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00252341
Message ID:
00252383
Vues:
8
>Whenever I want to search for a expression regardless of being
>capitals or not, I have to write as bellow:
>
>locate for UPPER(name) = UPPER(nm)
>locate for UPPER (city) = UPPER(Ct)
>locate for UPPER (street) = UPPER (st)
>
>I would like to avoid writting UPPER ( ) and instead of that, write something in my main.prg so that I could write as bellow:
>
>locate for name = nm
>locate for city = Ct
>locate for = BA
>
>
>May anybody suggest a function ?



Set Proc To main.prg additive
* at main.prg
procedure flocate
Lparameters pValue, pFieldName

lPCount = PCOUNT()

Do Case
Case lPCount = 1
       lFieldName = FIELD(1)  && Take Current Alias first columname

Case lPCount = 2
       lFieldName = pFieldName
EndCase

Locate For Upper("&lFieldName") = Upper("&pValue")

* for me, I would do like this:
* Locate For Alltrim(Upper("&pValue")) $ Alltrim(Upper("&lFieldName"))

EndProc
To call it,

Select Customer
FLocate("CUST0005")
browse

or

Select Customer
FLocate("Water", "Cust_Name")
browse


but... really need to put it as proc?! +_+
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform