Am Sonntag, 24. August 2008 18:48:08 schrieb Ed Leafe:
> On Aug 24, 2008, at 11:08 AM, Sibylle Koczian wrote:
> > I can answer that without running the application: the key zero
> > _doesn't_ exist. I had expected that by explicitly setting
> > PositionValue
> > to zero Keys and Choices would both be set to the values belonging to
> > the first list entry (Key = 1 and Choices accordingly). This may be
> > rather silly for the present case, but of course there are lookup
> > tables
> > where the first entry is chosen most often and should be preselected.
> > That shouldn't mean it must have a primary key of 0, should it?
>
>       If you follow the traceback, the error isn't coming from the setting
> of PositionValue, which should work just fine. It is the result of an
> update() call, which causes the control to set its Value from its
> DataSource/DataField.
>

True. I get the same exception if I comment out "self.PositionValue = 0".

>   File "/usr/lib/python2.5/site-packages/dabo/ui/
> dDataControlMixinBase.py",
> line 116, in update
>     self.Value = src.getFieldVal(self.DataField)
>   File "/usr/lib/python2.5/site-packages/dabo/ui/uiwx/
> dControlItemMixin.py",
> line 370, in _setValue
>     self.KeyValue = value
>
>       Since you have ValueMode = "Key", that means that your control's
> KeyValue is bound to the data source in the bizobj. Somehow the value
> in DataField of the current record in your bizobj is 0, and so the
> update() is trying to set that KeyValue to 0, which obviously doesn't
> exist.
>

The DataField of the dDropDownlist is the "clientfk" field of the "hours" 
table - and the form is showing a new record, so this field hasn't been set. 
Is that the problem, quite independent of the result of biz.getClients?

If I insert some reasonable "nothing chosen" string at the beginning of the 
Choices and 0 at the beginning of the Keys, everything works, and for this 
example that's best anyway. But if I want one of the records of my lookup 
table to be selected as default, how do I do it? 

>       How is it that the value for the DataField column is returning zero,
> but your biz.getClients() isn't returning zero as one of its PKs?
>

Thank you,
Sibylle

-- 
Dr. Sibylle Koczian


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

Reply via email to