Thanks - I'll give that a go!
----- Original Message ----- 
From: "Paul McNett" <[EMAIL PROTECTED]>
To: "Dabo Users list" <[email protected]>
Sent: Wednesday, November 19, 2008 12:20 PM
Subject: Re: [dabo-users] Data Types in Bizobj


> Roger Lovelock wrote:
>> I like the idea of setting up my DataStructure in my code rather than 
>> changing my database (since, at least in theory, it could be in use by 
>> other apps and I don't want to break them). As I generated my Bizobj from 
>> within the ClassDesigner the code is not in the biz folder, but instead 
>> is in the code file for my screen (and saved in the ui folder) - code as 
>> below :-
>>
>>
>> def createBizobjs(self):
>>  class MembershiptypesBizobj(dabo.biz.dBizobj):
>>
>>   def afterInit(self):
>>    self.DataSource = "MembershipTypes"
>>    self.KeyField = "MTypeID"
>>    self.addFrom("MembershipTypes")
>>    self.addField("MTypeDues")
>>    self.addField("MTypeDesc")
>>    self.addField("MTypeID")
>>
>>   def validateRecord(self):
>>    """Returning anything other than an empty string from
>>    this method will prevent the data from being saved.
>>    """
>>    ret = ""
>>    myval = self.Record.MTypeDesc
>>    if myval is None or myval =='':
>>     ret = "Please enter a description"
>>    # need to focus back on text field here
>>    # Add your business rules here.
>>    return ret
>>
>>  membershipTypesBizobj = MembershiptypesBizobj(self.Connection)
>>  self.addBizobj(membershipTypesBizobj)
>>  self.requery()
>>
>> Should I add an initProperties(self) method as in Uwe's example, set up 
>> the DataStructure in that, and then addFrom that data structure - or can 
>> I just set up the DataStructure directly and not need to add fields as a 
>> seperate step?
>
> Add initProperties() with the setting of the DataStructure (you can 
> probably copy it
> over from the AppWizard output for the same bizobj). You still need the 
> same
> addFrom() and addField() calls - those fulfill a different need.
>
> You can eventually move that bizobj code to a more sensible location, such 
> as in your
> project's biz directory, but leave it where it is for now until you 
> understand more
> about how Dabo works. The benefit of leaving it where it is: you can edit 
> it inside
> the ClassDesigner.
>
> Paul
>
>
[excessive quoting removed by server]

_______________________________________________
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