Re: Todays date in a field?



On Thu, 2009-12-03 at 22:43 +1300, Andrew Ruthven wrote:
On Thu, 2009-12-03 at 09:07 +0100, Murray Cumming wrote:
On Wed, 2009-12-02 at 18:30 -0200, Arq. Maximiliano Meilán wrote:
try in calculated field:

import time;
return time.strftime( "%Y-%m-%d" );

for today, works for me.

That's not ideal. It could be recalculated at any time. You could do
this in a button's script, though it would be more complicated because
there's not yet a nice python API for setting field values:
http://library.gnome.org/users/glom/unstable/sec-calculated-fields.html.en#using-the-full-pygda-api

We should probably just add a "today's date" button to the "..." date
selection button. It probably defaults to today's date anyway.

Ugh, still a bit of an ugly hack.

Can I put in a default value the PostgreSQL database to set it?  Perhaps
with a trigger on a modified column to update that?  (Yeah, I'm a
PostgreSQL guy.)

I would personally avoid using any PosgreSQL-specific feature, or doing
anything with PostgreSQL directly. There's no guarantee that Glom will
not explode now or later if you do. 

I have been working on a branch to add date/time created/modified fields
to all Glom tables by default, but it became complicated so it's not
finished. I will need it anyway to help with a replication feature that
I need.

Ah, that'd be handy.

However, Andre, Glom shouldn't crash. Please file a bug, ideally with
a .glom file attached.

Sure: https://bugzilla.gnome.org/show_bug.cgi?id=603686

Cheers!

_______________________________________________
glom-devel-list mailing list
glom-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/glom-devel-list


-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]