Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Right Recno()
Message
De
01/11/1999 22:53:17
 
 
À
01/11/1999 22:48:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00285239
Message ID:
00285269
Vues:
22
Hi Joao,

>I put the code that Eric tell me in the lostfocus event. What you said i know that, but was the way to turn over that problem.

You could use a canidate or primary index to validate uniquness. Here is something I execute from a DataBase field because I want to validate uniquness before the Index kicks in:

From the Rule I call this method
lparameters tcTable, tcField, teValue, tiPK
local lnCurWA, llReturn, lcExact, leValue

assert !empty(tcTable) and !empty(tcField) and !empty(teValue) and !empty(tiPK) ;
	message 'aDataMgr: Not enough params passed to EnforceUnique()'
assert file(iif(empty(justext(tcTable)),forceext(tcTable, 'dbf'), tcTable)) ;
	message 'aDataMgr: The passed tbale does not exist'

lnCurWA = select()
lcExact = set('exact')
set exact on

use (tcTable) again alias EnforceUnique in 0
select EnforceUnique

leValue = alltrim(teValue)
lcPrimaryKey = dbgetprop(juststem(dbf()),'table','PrimaryKey')

*locate for &tcField = teValue and &lcPrimaryKey <> tiPK
llReturn = !seek(teValue, 'enforceunique', tcField) or &lcPrimaryKey = tiPK

use
select (lnCurWA)
set exact &lcExact

return llReturn
This opens up the table as a different alias and checks the uniquness before the value is even allowed in the table.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform