Re: example of python script



On Wed, 2009-01-07 at 03:44 +1100, J. Donald R. de Raadt wrote:
I am new to GLOM and would like to use it instead of FileMaker. I have 
managed most things except writing a python script for a button. I 
manage OK with field calculations, but I have no idea of how to manage a 
button script. The button script in one of the database examples is far 
too complex for a newbie to follow. To get started, I need a simple 
example with a couple of field manipulations, done through a button 
rather than field definition: e.g. combine two text fields together, or 
multiply price by quantity. Thanks in advance.
Donald

You can get field values in a button script just as you would in a field
definition. For instance:
http://library.gnome.org/users/glom/unstable/sec-calculated-fields.html.de#field-values

But unfortunately, you cannot currently use that same syntax to _set_
values. I filed a bug about that so we can implement it eventually:
http://bugzilla.gnome.org/show_bug.cgi?id=567041

In the meantime, you can set the values directly in the Postgres
database, using the pygda API. Unfortunately, like many Python APIs,
that's not really documented yet.

But here's a little example:
http://library.gnome.org/users/glom/unstable/sec-calculated-fields.html.en#using-the-full-pygda-api

There are other examples in my "Repository Analyzer" Glom system:
http://www.murrayc.com/blog/permalink/2006/10/25/repository-analyzer-improvements/

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




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