Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP6SP5 - Table of Default Values and Validation for Cri
Message
From
03/06/2003 03:42:48
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00795245
Message ID:
00795547
Views:
24
>Hi all,
>
>Recently I have tried out the following. Could you kindly check out my work and point out any pitfalls / shortcomings / inefficiencies that maybe lurking in the depths of euphoria that I am feeling about this work of art <g>.
>
>I have defined a table mFieldDefaultsValids:
>
>iID				I		Primary Index
>cViewFldName	C(30)	Candidate Index		Containg the ControlSource text for locate
>cDefault		M		Expression to be EVAL()ed
>cValidate		M		Expression to be EVAL()ed
>cValidMsg		M		The Message if validation fails
>
>
>
>In the Business Object's AfterNew():
>
>LPARAMETERS tnRetVal
>
>LOCAL lnI, lcViewFldName
>
>tnRetVal = DODEFAULT(tnRetVal)
>
>*** manage select areas
>
>FOR lnI = 1 TO FCOUNT()
>	lcViewFldName = "V_TROUTINETEST." + UPPER(FIELD(lnI))
>
>	SELECT v_LKmFieldDefaultsValids
>
>	LOCATE FOR cViewFldName = lcViewFldName
>
>	IF FOUND()
>         REPLACE (lcViewFldName) WITH EVALUATE(v_LKmFieldDefaultsValids.cDefault)
>	ENDIF
>
>	SELECT v_tRoutineTest
>ENDFOR
>
>*** manage select areas
>
>RETURN tnRetVal
>
>
>
>In the Form.TextBox.Valid(), This I am not entirely satisfied with, I feel there should be more automation like the function above, as this becomes a field-by-field basis coding:
>
>LOCAL llRetVal
>
>llRetVal = DODEFAULT()
>
>IF llRetVal
>	*** manage select areas
>
>	LOCATE FOR cViewFldName = UPPER(THIS.CONTROLSOURCE)
>
>	IF FOUND()
>		llRetVal = EVALUATE(v_LKmFieldDefaultsValids.cValidate)
>
>		IF !llRetVal
>			= MESSAGEBOX(EVALUATE(v_LKmFieldDefaultsValids.cValidMsg))
>		ENDIF
>	ENDIF
>
>	*** manage select areas
>ENDIF
>
>RETURN llRetVal
>
>
>
>Finally ...
>Q1. Will this become bulky and inefficient in bigger apps, where there will be more defaults and/or validations?
>Q2. Will this be inefficient where many fields are without default and/or validations?
>Q3. Memo corruptions dangers? I will be using non-updatable views for quering thus the LooKup in v_LK

Looking as per your request. Honestly read before but didn't understand what you're trying to do. Sounds like AfterNew() is filling the new record with defaults. And sounds textbox.valid is validating the content, right ?
If so why not directly edit view to have these defaults, validations and validationtext. You could write a developer tool (prg) to get these defaults and validation from base table(s) and put into view properties. To me it seems to be easier to do a series of dbgetprop()/dbsetprop(). Or directly use 'Properties' button of designer (if you're using the designer), still would be easier, no?
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform