On Tuesday, December 21, 2010 07:43:00 am Ed Leafe wrote:
> On Dec 21, 2010, at 12:19 AM, John Fabiani wrote:
> > Writing data to the array is not working.
> > 
> > self.testbizobj.setFieldVal('pay_by_quarter[0]', 2000)
> > 
> > Traceback (most recent call last):
> >  File "<input>", line 1, in <module>
> >  File "/home/johnf/dabo/dabo/biz/dBizobj.py", line 1631, in setFieldVal
> >  
> >    ret = cursor.setFieldVal(fld, val, row)
> >  
> >  File "/home/johnf/dabo/dabo/db/dCursorMixin.py", line 962, in
> >  setFieldVal
> >  
> >    _("Field '%s' does not exist in the data set.") % (fld,))
> > 
> > FieldNotFoundException: Field 'pay_by_quarter[0]' does not exist in the
> > data set.
> > 
> > I suspected this because Dabo is looking for real field and not list.
> > 
> > but this works
> > self.testbizobj.setFieldVal('pay_by_quarter',[2000,3000,4000,5000])
> > self.testbizobj.save()
> 
>       Close, but...
> 
>       setFieldVal() takes the column name as its first argument;
> 'pay_by_quarter[0]' is not the name of the column; 'pay_by_quarter' is.
> That's why the second form works.
> 
> 
> 
> -- Ed Leafe

I agree.  I also think that for the moment there is no other way to handle 
arrays.  Therefore, using the arrays in a form will require special handling 
for saves etc...  Of course this is not difficult to do - thanks to all the 
bizobj hooks (beforeNew,beforeSave, afterSave, afterRequery etc...) that are 
provided.  When creating the bizobj class these hook methods can be used to 
deal with the data.  Also I suspect that virtual fields will help too.

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