Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6SP5 - Table of Default Values and Validation for Critica
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
VFP6SP5 - Table of Default Values and Validation for Critica
Divers
Thread ID:
00795245
Message ID:
00795245
Vues:
55
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
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform