Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking some field for uniqueness
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00518556
Message ID:
00518565
Vues:
9
2 ways I can think of. You can do:

SELECT COUNT(*) Kount FROM AllFunctions ;
Where FunName = ThisFrom.txtFunName.Value ;
into cursor crsKount
if crsKount.Kount > 1
else
endif

If that is not fast enough, try this:

lparameter tcFunName
if vartype(tcFunName) <> "C" or empty(tcFunName)
return .f.
endif
if not used('AllFun_2')
use AllFunctions again in 0 alias AllFun_2
endif
local lnSelect
lnSelect = select()
select AllFun_2
set order to FunName
seek upper(lcFunName)
select (lnSelect)
return eof('AllFun_2')



>Hi everybody,
>
>I had discussion on the same topic long time ago, but I have this problem again and I'm not sure, how to handle it.
>I have a table called AllFunctions. This table has FunctionID field (Primary autogenerated), FunName field and couple of other fields. FunName is the function name, which is entered by the user. My question is: how can I ensure uniqueness of this field? I want to have message at the time FuncionName is entered into the table and another check should be performed at the time of saving record. We have a class wgUniqueText, but I've just realized, that the code in it is not sufficient.
>
>Do you have ideas to share?
>
>Thanks in advance.
>
>P.S. Table has a regular index on FunName with expression upper(FunName)
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform