Paul,

I'm not sure exactly what is going on, but my virutal field seems to work
fine.  I think that it's perhaps because I am using is to generate another
dataset, which I think is just "using" the virtual field as a template and
creating a read-write field in the subsequent datasets.


Class mybizobj
        ##set up virtual field
        def _getlselected(self):
                return getattr(self, "_lselected", False) ##False to
initialize boolean
        def _setlselected(self, val):
                self._lselected = val
        lselected = property(_getlselected, _setlselected)
 

        Def getBalances(self):
                #use virtual field to create new dataset
                csql="select sum(nqty) as nqty, clocation, lselected, um
from dataset"
                
                csql= csql + " group by clocation having sum(nqty)>0 order
by clocation"

                try:
                        self.MainForm.distgridID.DataSet={}
                except:
                        pass

                try:
                        self.MainForm.TotalSelected=0
                except:
                        pass
                
                if self.RowCount>0:
                        ds=self.getDataSet()
                        ds2=ds.execute(csql)
                        #virtual field is now a read-write field in the new
data set.
                        ds3=ds2.execute('select cast((nqty/1000.) as
numeric(12,3)) as ndispqty, nqty, clocation, um, lselected from dataset') 
                
                        ok=False
                        try:
                                self.MainForm.distgridID.DataSet=ds3 
                                self.MainForm.resetDistQtys()
                                ok=True
                        except:
                                pass

Larry
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Paul McNett
Sent: Monday, August 13, 2007 3:22 PM
To: Dabo Users list
Subject: Re: [dabo-users] data in a grid

[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?

--
pkm ~ http://paulmcnett.com


[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/dabo-users/!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAafA2fnYuPUOMNFpIYnBEQcKAAAAQAAAA4Y/[EMAIL
 PROTECTED]

Reply via email to