Re: Todays date in a field?



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 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!

-- 
Andrew Ruthven
Wellington, New Zealand
At home: andrew etc gen nz |          linux.conf.au 2010 
                           | Follow the signs. Visit Wellington!
                           |      http://www.lca2010.org.nz

Attachment: ruthven3example.glom
Description: application/glom

Attachment: signature.asc
Description: This is a digitally signed message part



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