On Dec 31, 2009, at 7:13 AM, Carey Gagnon wrote:

>> After a new record is saved, the value of the auto-generated PK should be
> available in your bizobj via self.getPK(). So your code would read:
> 
> Does the self.getPK() actually go in the bizobj file??
> 
> The code snippet below is in the frmDC2010Add-code.py file that was created
> when I made the frmDC2010Add.cdxml in the CD.
> Is this the right place for it??
> 
> def afterSave(self):
>>       newPK = self.getPK()
>>       dabo.ui.info("Record successfully saved. Your new number is DC10-
>> %s" % newPK, title="Success")
>>        self.new()
>>       self.BuilderName.setFocus()

        Ah, you misunderstood what I meant by "in your bizobj". I meant that in 
your bizobj code, you would call 'self.getPK()'. Outside of your bizobj, such 
as in your form code, you'd have to use a reference to the bizobj. E.g.:

def afterSave(self):
      newPK = self.PrimaryBizobj.getPK()
      dabo.ui.info("Record successfully saved. Your new number is DC10-
%s" % newPK, title="Success")
      self.new()
      self.BuilderName.setFocus()

> I tried several things to get the info dialog to fire, which it wouldn't as
> long as the newPK = self.getPK() line existed or %s" % newPK existed in the
> dabo.ui.info line. I'm stumped.

        Since this is form code, and your form doesn't have a getPK() method, 
most likely Python threw an AttributeError on the call to self.getPK(). Fix the 
reference, and it should work.

>>> We will never have anymore than 999 entries.
>> 
>>        Why does my stomach feel uneasy when I read a statement like that?
>> ;-)
> 
> It's a single DB per year and history shows I should be ok, and it makes my
> stomach less uneasy using Dabo than keeping this thing in an MS Access DB as
> it currently exists.  ;^)

        I've worked for many clients who made claims like "we will never need 
more than one phone number per customer" or "part numbers will never be more 
than 4 places" or "640K will be enough for anyone". (OK, that last one wasn't 
from one of my clients!).

        Assuming single-year tables sure sounds like a premature optimization 
to me, and one that could limit the application later on.


-- Ed Leafe



_______________________________________________
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