On Monday 13 August 2007 12:22, Paul McNett wrote:
> [EMAIL PROTECTED] wrote:
> > John,
> >
> > I fixed this issue by using a virtual field for the grid.
> >
> > FYI (to others), John and I were using a cursor defining a field as
> > ..."(0 as boolean) as lselected", in an execute statement to create a
> > temporary column so that the user could select one or more records to
> > process. I am guessing that when we issued a getDataSet command trying to
> > selected the records, it was just re-issuing the "0 as boolean" vs
> > looking at the current value.
>
> I think in that case if you issued biz.getDataSet() (or grid.DataSet)
> you would indeed see the current, correct values. However, if you issued:
>
> ds = grid.DataSet
> print ds.execute("select * from dataset")
>
> Perhaps that doesn't hold.
>
> How does using VirtualFields help here, since those are read-only and
> you want to write to it?
Actually to populate the grid we create a DataSet from a Bizobj (that uses a 
VirtualField) using a Select statement.  So the grid DataSet is a result of a 
select statement on the bizobj.  Larry has rewritten my code to use a select 
statement to determine the which rows are checked (lSelected=1).   I am not 
sure why it works but it does.  

moveds=self.distgridID.DataSet.execute('select * from dataset where 
lselected=1')
                moveqty=0
                movedqty=0
                baltomove=self.qtytomovepgf.BaseValue
                
                for myitem in moveds:
                        #oktouse=False
                        #for key, value in myitem.items():
                                #if key == 'nqty':
                                        #myqty = value
                                #if key=='lselected' and value==1:
                                        #oktouse=True
                                #if key=='clocation':
                                        #myloc=value
                        #if oktouse:
                                #nqty=myqty
                                #moveqty=min(baltomove,nqty)
                        moveqty=min(baltomove,myitem['nqty'])
                        myloc=myitem['clocation']
                        if moveqty>0:
                                o.new()
                                o.setFieldVal('clocation',myloc)
                                o.setFieldVal('nqty',-moveqty)
                                o.setFieldVal('ntransid',invtransno)
                                baltomove=max(baltomove-moveqty,0)
                                movedqty=movedqty+moveqty
                        if baltomove==0:
                                break
-- 
John Fabiani


_______________________________________________
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/dabo-users/[EMAIL PROTECTED]

Reply via email to