Ed Leafe wrote:
> On Dec 14, 2008, at 10:28 AM, Bob Sysero llc Dev wrote:
>
>   
>> I am working on number 2 and in the Class Designer my button Create
>> Spread Sheet Object dCreateCalc:
>> def onHit(self, evt):
>> customerBizobj = self.Form.getBizobj("customer")
>> customerBizobj.spreadSheetBizObj()
>>     
>
>       Please don't do it this way. It leads to all sorts of tangled code.  
> What if you want to add a menu item to do the same thing? How about a  
> tool bar action, or a right-click action? If you put all your logic in  
> the event handler of a particular button, you now have to find a way  
> to call that logic from all sorts of different places. Or copy/paste  
> that same logic into a bunch of different handlers, which is a  
> maintenance headache.
>
>       Have the button's onHit handler call a method in the form. You'll  
> thank me later.
>   
In number 1 I call the spreadSheet() within the Form which one
is the easy way. Latter the spreadSheet() which I will later place it
in a class called createSpreadSheet() that will contain many methods.
I would like to then place this in a libary module called
createSpreadSheet.py.

What I am learning is that the bizObj is self contained and methods
created in the BizObj is to act on the data like calc customer discount
rates for example. In the validation to check on data entry errors and if
found return to the form that allow the user to correct the error. The
bizObt is not designed to be called from the CD onHit event to process
the Business Rule in processing the Customer SpreadSheet. In other
words perform that process from within the CD or Library by getting the 
bizObj
and data set. Am I correct?


>   
>> This works and I am able to call customerBizobj.spreadSheetBizObj()
>> by placing a dabo.Trace() at the start of my spreadSheetBizObj()  
>> method.
>> The problem is how to access the dataSet within the  
>> spreadSheetBizObj()
>> method.  I tried different ways with the simple error:
>>   custmerBizObj = self.getBizobj("Customer")
>> AttributeError: 'CustomerBizobj' object has no attribute 'getBizobj'
>>     
>
>       Looks like 'self' in this context is already the bizobj. IOW, you  
> aren't in form code, but bizobj code. Forms get references to their  
> bizobj by calling their getBizobj() method.
>
>   
>> I just was looking at the code in my Object dCrateCalc and I might be
>> able to get the dataSet and pass it into my
>> customerBizobj.spreadSheetBizObj(dataSet).
>> customerBizobj = self.Form.getBizobj("customer")
>> customerDataSet =customerBizobj.getDataSet()
>> customerBizobj.spreadSheetBizObj(customerDataSet)
>>     
>
>       I guess I'm not sure what you're trying to do in the last line. What  
> is 'spreadSheetBizobj'? Looking at the code later on in your message,  
> it seems that that is a bizobj method that creates the spreadsheet. Is  
> that correct? If so, I would suggest a more descriptive method name  
> such as 'createSpreadsheet()'. Also, you don't need to get the dataset  
> in one bizobj method and pass it to another method in the same bizobj;  
> that second method can just as easily call 'self.getDataSet()'.
>   
I should have seen that that self.getDataSet() the getDataSet() is
in the scope of the bizObj. If that is right then I am understanding
the scope of the self the use of the bizObj and dataSet.





_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to