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 failsIn 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 tnRetValIn 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 llRetValFinally ...