Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Business Rules
Message
From
18/03/2004 11:40:22
Jason Mesches
Ocean Systems Engineering Corporation
Carlsbad, California, United States
 
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
Miscellaneous
Thread ID:
00887232
Message ID:
00887553
Views:
10
Jose,
Couple of issues:

1. What does your "OK" button do? If it saves the data on your form, your rules are already being checked by the framework prior to the TABLEUPDATE() attempt. When program control returns to the OK button, you could set focus according to the contents of your BizRules class' aBrokenRules array:
LOCAL liLoop, loRuleObj, lcBrokenRule
loRuleObj = ThisForm.oBizObj.oBizRules
IF DODEFAULT() # FILE_OK
   FOR liLoop = 1 TO loRuleObj.GetCount()
      lcBrokenRule = loRuleObj.GetBrokenRule(liLoop)
      *You'd have to create a priority list here (DO CASE statement maybe?)
      *   for the potential broken rules and set focus based on lcBrokenRule value.
      
   NEXT liLoop
ENDIF
This gets fairly messy, which is why I was suggesting to check the rules in the valid routine.


2. Typically, CheckRules() is set up as a "master" method that calls others to validate specific fields:
*CheckRules() code
This.IsProjectNameValid()
This.IsField2Valid()
This.IsField3Valid()
This.IsField4Valid()
If you're using CheckRules() in this manner, you'll want to call the specific field validation routine(s) instead of the "master" method. Otherwise, you may create extraneous broken rules for validation routines you didn't intend to check.

Hope that makes sense,
---J

>Thanks Jason. Look what I did in the Click method of the "OK" button.
>
>
>LOCAL	loBizRules, llRetVal, lnRetVal
>
>loBizRules = ThisForm.oBizObj.oBizRules
>
>llRetVal = loBizRules.CheckRules()
>
>IF .NOT. llRetVal
>
>	This.Parent.txlProjectName.TextBox.SetFocus()
>
>ENDIF
>
>lnRetVal = DODEFAULT()
>
>RETURN (lnRetVal)
>
Previous
Reply
Map
View

Click here to load this message in the networking platform