Index
2012-02-16 12:55 – Matt Jackson : [dabo-users] Modifying field as part of verifyRecord or beforeSave?
2012-02-16 13:47 – Adrian Klaver : Re: [dabo-users] Modifying field as part of verifyRecord or beforeSave?
2012-02-16 14:50 – John Fabiani : Re: [dabo-users] Modifying field as part of verifyRecord or beforeSave?
2012-02-16 15:09 – Adrian Klaver : Re: [dabo-users] Modifying field as part of verifyRecord or beforeSave?
2012-02-24 12:34 – Matt Jackson : Re: [dabo-users] Modifying field as part of verifyRecord or beforeSave?
Back to top
[dabo-users] Modifying field as part of verifyRecord or beforeSave?

Author: Matt Jackson

Posted: 2012-02-16 12:55:35   Link

Hello all:

Dabo is a great software package. I'm in the process of moving Microsoft

access applications over to Dabo and using MySql as a backend. It's

working really well.

What are the ways to support the continuing development of Dabo if any?

My main question involves a table where I've added a DateMod and DateIns

columns. They are timestamps to track when a record was last modified and

when it was added. I've found these to be valuable in past systems. I've

put logic in the bizObj that handles this table to update the DateMod field

when a record is saved.

I'm wondering where the best place is to put statements that update other

information in a record based upon actions the user has taken, before the

record is saved.

I first put the code in the bixObj.beforeSave() method.

lstChanged = self.getChangedRows()

for row in lstChanged:

self.setFieldVal("DateMod", datetime.datetime.today(), rownumber)

return None

There were no errors thrown but the data was not saved either.

I then tried putting in validateRecord just

self.setFieldVal("DateMod", datetime.datetime.today())

return None

This works.

I saw on dabo-users that a comment about trying to do changes to the data

before a save. It said that remember to restore row pointer when returning

from beforeSave().

Is the reason that my code in the beforeSave() method didn't work was

because the rowpointer was moved in my code and not restored? I was

concerned that my program did not work as I'd wanted but there was no error

thrown meaning I really didn't understand what was happening in the saving

process.

Again, amazing package and really lives up to your saying "It just works".

Thanks,

Matt J.

--

Matt Jackson

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

_______________________________________________

Post Messages to: Dabo-users@leafe.com

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/CAKsSVx=gnqvaw8ZNbgo5uxNtYpZTSs4FnYBdZbT5dvBwLs1RrA@mail.gmail.com

©2012 Matt Jackson
Back to top
Re: [dabo-users] Modifying field as part of verifyRecord or beforeSave?

Author: Adrian Klaver

Posted: 2012-02-16 13:47:25   Link

On 02/16/2012 09:55 AM, Matt Jackson wrote:

> Hello all:

> Dabo is a great software package. I'm in the process of moving Microsoft

> access applications over to Dabo and using MySql as a backend. It's

> working really well.

> What are the ways to support the continuing development of Dabo if any?

>

> My main question involves a table where I've added a DateMod and DateIns

> columns. They are timestamps to track when a record was last modified and

> when it was added. I've found these to be valuable in past systems. I've

> put logic in the bizObj that handles this table to update the DateMod field

> when a record is saved.

>

> I'm wondering where the best place is to put statements that update other

> information in a record based upon actions the user has taken, before the

> record is saved.

I generally put this in the database. I use Postgres so I use a

combination of a default value and a UPDATE trigger. For MySQL there are

some builtins for timestamp that do this;

http://dev.mysql.com/doc/refman/5.0/en/timestamp.html

One less thing to hassle with in the app, especially if you different

apps pointing at the db.

>

>

>

> Thanks,

> Matt J.

>

--

Adrian Klaver

adrian.klaver@gmail.com

_______________________________________________

Post Messages to: Dabo-users@leafe.com

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/4F3D4F3D.9060901@gmail.com

©2012 Adrian Klaver
Back to top
Re: [dabo-users] Modifying field as part of verifyRecord or beforeSave?

Author: John Fabiani

Posted: 2012-02-16 14:50:31   Link

On Thursday, February 16, 2012 10:47:25 AM Adrian Klaver wrote:

> I generally put this in the database. I use Postgres so I use a

> combination of a default value and a UPDATE trigger. For MySQL there are

> some builtins for timestamp that do this;

>

> http://dev.mysql.com/doc/refman/5.0/en/timestamp.html

>

> One less thing to hassle with in the app, especially if you different

> apps pointing at the db.

Like you I generally put it this type of requirement into the database. I

also use Postgres.

But I do wonder why the first did method did not work? If he used Form.Save()

it should have worked. I have used beforeSave() in the past (but from the

form and not the bizobj) and all worked.

Johnf

_______________________________________________

Post Messages to: Dabo-users@leafe.com

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/16214566.tOTVrf5OFk@linux-12

©2012 John Fabiani
Back to top
Re: [dabo-users] Modifying field as part of verifyRecord or beforeSave?

Author: Adrian Klaver

Posted: 2012-02-16 15:09:25   Link

On 02/16/2012 11:50 AM, John Fabiani wrote:

> On Thursday, February 16, 2012 10:47:25 AM Adrian Klaver wrote:

>

>> I generally put this in the database. I use Postgres so I use a

>> combination of a default value and a UPDATE trigger. For MySQL there are

>> some builtins for timestamp that do this;

>>

>> http://dev.mysql.com/doc/refman/5.0/en/timestamp.html

>>

>> One less thing to hassle with in the app, especially if you different

>> apps pointing at the db.

>

>

> Like you I generally put it this type of requirement into the database. I

> also use Postgres.

>

> But I do wonder why the first did method did not work? If he used Form.Save()

> it should have worked. I have used beforeSave() in the past (but from the

> form and not the bizobj) and all worked.

Probably needs to use saveAll() instead of save() per:

http://paul.dabodev.com/doc/api/dabodoc/dabo.biz.dBizobj.dBizobj.html#Methods_save

save(self, startTransaction=True, saveTheChildren=True)

Save any changes that have been made in the current row.

If the save is successful, the saveAll() of all child bizobjs will be

called as well if saveTheChildren is True (the default).

saveAll(self, startTransaction=True, saveTheChildren=True)

Save changes to all rows in the bizobj, and (by default) the children.

Works from a form because the default is SaveAllRows = True

>

> Johnf

Adrian Klaver

adrian.klaver@gmail.com

_______________________________________________

Post Messages to: Dabo-users@leafe.com

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/4F3D6275.6070402@gmail.com

©2012 Adrian Klaver
Back to top
Re: [dabo-users] Modifying field as part of verifyRecord or beforeSave?

Author: Matt Jackson

Posted: 2012-02-24 12:34:29   Link

On Thu, Feb 16, 2012 at 1:09 PM, Adrian Klaver <adrian.klaver@gmail.com>

wrote:

>

> On 02/16/2012 11:50 AM, John Fabiani wrote:

> > On Thursday, February 16, 2012 10:47:25 AM Adrian Klaver wrote:

> >

> >> I generally put this in the database. I use Postgres so I use a

> >> combination of a default value and a UPDATE trigger. For MySQL there

> >> are

> >> some builtins for timestamp that do this;

> >>

> >> http://dev.mysql.com/doc/refman/5.0/en/timestamp.html

> >>

> >> One less thing to hassle with in the app, especially if you different

> >> apps pointing at the db.

> >

> >

> > Like you I generally put it this type of requirement into the database.

> > I

> > also use Postgres.

> >

I agree the database would be the best place. Just wanting to understand

the framework and the back end MySql is new to me as well.

> > But I do wonder why the first did method did not work? If he used

> > Form.Save()

> > it should have worked. I have used beforeSave() in the past (but from

> > the

> > form and not the bizobj) and all worked.

>

> Probably needs to use saveAll() instead of save() per:

>

>

>

http://paul.dabodev.com/doc/api/dabodoc/dabo.biz.dBizobj.dBizobj.html#Methods_save

>

> save(self, startTransaction=True, saveTheChildren=True)

> Save any changes that have been made in the current row.

>

> If the save is successful, the saveAll() of all child bizobjs will be

> called as well if saveTheChildren is True (the default).

>

>

> saveAll(self, startTransaction=True, saveTheChildren=True)

> Save changes to all rows in the bizobj, and (by default) the children.

>

>

>

> Works from a form because the default is SaveAllRows = True

>

I haven't tried this yet. Having the code in the verifyRecord method has

been working great so far.

Thanks for the help.

> >

> > Johnf

>

> Adrian Klaver

> adrian.klaver@gmail.com

> _______________________________________________

> Post Messages to: Dabo-users@leafe.com

> 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/4F3D6275.6070402@gmail.com

--

Matt Jackson

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

_______________________________________________

Post Messages to: Dabo-users@leafe.com

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/CAKsSVxnhX9LbRxvd2EKzTAsXh99-3B55KVGwrY2N8F=NkZrR6A@mail.gmail.com

©2012 Matt Jackson