Hi Ed, yes, I thought about something like that and it should do the trick (instead of 'null' I'd take an empty string). The Problem is with date or integer fields where there is no value that could represent NULL. I'm going to have to think about a way around it...
By the way, thanks for all the effort you put into dabo. It's the only open source database application framework that I am aware of (apart from gnuenterprise, which doesn't seem very alive). Best Regards Peter -------- Original-Nachricht -------- > Datum: Tue, 13 Jan 2009 09:22:04 -0600 > Von: Ed Leafe <[email protected]> > An: Dabo Users list <[email protected]> > Betreff: Re: [dabo-users] Setting Field Values to NULL > On Jan 12, 2009, at 7:53 AM, Peter Seckler wrote: > > > how do I give the user of the Dabo application the possibility to > > explicitly set a database field to NULL? Say, there is a table: > > > > CREATE TABLE items ( > > id serial primary key, > > item text, > > description text, > > size integer) > > > > and three dTextBox widgets associated with those fields. > > > > The table contains the following record (3, "Some Item", "Some > > Description", 15), > > > > how can the user set items.size and items.description to NULL? > > Leaving the TextBox blank doesn't work. Is there a special key > > sequence or something like that? Or do I have to code this myself > > for every field like > > > > if fieldValue=="" then fieldValue=None ? > > That's one that I haven't thought about. UIs typically don't have a > way to enter null values without using separate controls. If you > wanted to do this all with a textbox, you could do something like > this: establish a string that will represent null (say, 'null' or > 'None', depending on your preference), and then in the bizobj for that > table, override setFieldVal() like this: > > def setFieldVal(self, fld, val, row=None): > if fld in ("item", "description"): > if val == "null": > # This is the string indicating null values > val = None > super(ThisBizobjClass, self).setFieldVal(fld, val, row=row) > > > > -- Ed Leafe > > > > > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] 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/[email protected]
