Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6SP5 - Table of Default Values and Validation for Cri
Message
De
05/06/2003 08:02:31
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00795245
Message ID:
00796583
Vues:
22
Yes actually there is a suggestion after checking what I suggested :)
You're setting validations from another table. It would work if :
Base table has no validation expression or matches yours.
Consider this scenario :
In base table you set a field's rule expression as IsDigit(Field)
From your metadata you set field in view with an expression !IsDigit(Field).
When your view submits the change base table would reject it and set to empty/null.
IOW if you're carefull enough not to make such errors than you should be OK.
Next :
If you're setting these with dbsetprop() and controlsource is directly bound to view.fieldname (most likely will be), your validation would execute as soon as you hit a key to leave the field and ValidationText from DBC would popup.
Are we back to where we started?
PS: OTOH triggers don't fire till tableupdate(). Some fields' valid value might be dependant on other fields. So thinking would it be better to check for validations during tableupdate (mark those failed and a single messagebox for all?).
Cetin



>This is the final piece of art that you had suggested. Thanks. Any suggestions.
>
>BO.DefaultRecords()
>
>THIS.WriteToViewDBC()
>
>
>BO.WriteToViewDBC
>
>SCAN
>	= DBSETPROP("l" + v_mFieldDefaultsValids.cViewFldName, "FIELD", "DefaultValue", v_mFieldDefaultsValids.mDefault)
>	= DBSETPROP("l" + v_mFieldDefaultsValids.cViewFldName, "FIELD", "RuleExpression", v_mFieldDefaultsValids.mValidate)
>	= DBSETPROP("l" + v_mFieldDefaultsValids.cViewFldName, "FIELD", "RuleText", v_mFieldDefaultsValids.mValidMsg)
>ENDSCAN
>
>
>
>
>TextBox.Valid()
>
>THIS.CheckValidations()
>
>
>TextBox.CheckValidations()
>
>LOCAL lcValidation
>
>lcValidation = DBGETPROP("l" + THIS.CONTROLSOURCE, "FIELD", "RuleExpression")
>
>IF (!EMPTY(lcValidation)) AND (!EVALUATE(lcValidation))
>	= MESSAGEBOX(IIF(TYPE(THIS.cAssociatedLabel + ".CAPTION") = "C", ;
>		EVALUATE(THIS.cAssociatedLabel + ".CAPTION") + ": ", "") + ;
>		EVALUATE(DBGETPROP("l" + THIS.CONTROLSOURCE, "FIELD", "RuleText")))
>ENDIF
>
>
>>>>OK so you want to manage from another table as metadata. How about doing your way but changing default/validation for view once at a suitable place (typically when metadata is edited and saved).
>>>
>>>Yes
>>>
>>>>
>>>>ie : You could do like this :
>>>>
>>>>
>>>>open data myData
>>>>select metadata
>>>>scan
>>>>  lcViewField = trim(VievName -'.'-ViewFieldName)
>>>>  DBSetProp(lcViewField,"FIELD","RuleText",FieldRuleText)
>>>>  DBSetProp(lcViewField,"FIELD","RuleExpression",FieldRuleExpr)
>>>>  DBSetProp(lcViewField,"FIELD","DefaultValue",FieldDefaultExpr)
>>>>endscan
>>>>
Cetin
>>>
>>>Wow that means that I can do this once (at time of reinstllation) and I can avoid unnecesary function calls.
>>>
>>>I will try this at the soonest.
>>
>>Yes. Also after doing that :
>>compile database DBCName && VFP6 SP3 and later
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform