Re: Todays date in a field?



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

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


El jue, 03-12-2009 a las 09:11 +1300, Andrew Ruthven escribió:
Hey,

Another little niggle I'm working on.  I've added a "notes"t table and
want it to have a date "created" field, which defaults to today.  I've
tried setting "calculate value" on the field, and setting it to:

import datetime

return datetime.date.today()

But when I hit the "test" button, glom crashes.  Is this something that
people do?

Cheers!

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


_______________________________________________
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]