I tried Paul's example with the virtual fields but am not having any luck with 
it. Below is the code generated from the AppWizard for the bizobj. Tell me if 
this looks correct:

# -*- coding: utf-8 -*-

from dabo.dLocalize import _
from Base import Base


class B1(Base):

        def initProperties(self):
                super(B1, self).initProperties()
                self.Caption = "B1"
                self.DataSource = "B1"
                self.KeyField = ""
                self.VirtualFields["drop_current"] = self.getDisplayAmount
                self.VirtualFields["pick_current"] = self.getDisplayAmount
                self.VirtualFields["working_current"] = self.getDisplayAmount
                self.VirtualFields["drop1res"] = self.getDisplayAmount
                self.VirtualFields["drop2res"] = self.getDisplayAmount
                self.VirtualFields["drop3res"] = self.getDisplayAmount
                self.VirtualFields["drop4res"] = self.getDisplayAmount
                self.VirtualFields["drop5res"] = self.getDisplayAmount
                self.VirtualFields["drop6res"] = self.getDisplayAmount
                self.VirtualFields["drop7res"] = self.getDisplayAmount
                self.VirtualFields["drop8res"] = self.getDisplayAmount
                self.VirtualFields["drop9res"] = self.getDisplayAmount
                self.VirtualFields["pick1res"] = self.getDisplayAmount
                self.VirtualFields["pick2res"] = self.getDisplayAmount
                self.VirtualFields["pick3res"] = self.getDisplayAmount
                self.VirtualFields["pick4res"] = self.getDisplayAmount
                self.VirtualFields["pick5res"] = self.getDisplayAmount
                self.VirtualFields["pick6res"] = self.getDisplayAmount
                self.VirtualFields["pick7res"] = self.getDisplayAmount
                self.VirtualFields["pick8res"] = self.getDisplayAmount
                self.VirtualFields["pick9res"] = self.getDisplayAmount


                # dict in the form of
                # {'colname': [_('caption for colname'),
                #              _('tooltip for colname'),
                #              _('helptext> for colname')]}

                self.ColTextsDict = {}

                # Setting the DataStructure explicitly here is optional, but 
recommended as
                # it will keep Dabo from interpreting field types from the 
backend every
                # time. It lets you specify what types you expect which fields 
to be. Also,
                # this information is used in self.setSQL() to add the fields 
to the query.
                # (field_alias, field_type, pk, table_name, field_name, 
field_scale)
                self.DataStructure = (
                                ("part_number", "C", False, "B1", 
"part_number"),
                                ("serial_number", "C", False, "B1", 
"serial_number"),
                                ("clockid", "C", False, "B1", "clockid"),
                                ("contact_verification", "B", False, "B1", 
"contact_verification"),
                                ("drop_current", "N", False, "B1", 
"drop_current"),
                                ("pick_current", "N", False, "B1", 
"pick_current"),
                                ("working_current", "N", False, "B1", 
"working_current"),
                                ("drop1res", "N", False, "B1", "drop1res"),
                                ("drop2res", "N", False, "B1", "drop2res"),
                                ("drop3res", "N", False, "B1", "drop3res"),
                                ("drop4res", "N", False, "B1", "drop4res"),
                                ("drop5res", "N", False, "B1", "drop5res"),
                                ("drop6res", "N", False, "B1", "drop6res"),
                                ("drop7res", "N", False, "B1", "drop7res"),
                                ("drop8res", "N", False, "B1", "drop8res"),
                                ("drop9res", "N", False, "B1", "drop9res"),
                                ("pick1res", "N", False, "B1", "pick1res"),
                                ("pick2res", "N", False, "B1", "pick2res"),
                                ("pick3res", "N", False, "B1", "pick3res"),
                                ("pick4res", "N", False, "B1", "pick4res"),
                                ("pick5res", "N", False, "B1", "pick5res"),
                                ("pick6res", "N", False, "B1", "pick6res"),
                                ("pick7res", "N", False, "B1", "pick7res"),
                                ("pick8res", "N", False, "B1", "pick8res"),
                                ("pick9res", "N", False, "B1", "pick9res"),
                )

                # Use the DefaultValues dict to specify default field values 
for new
                # records. By default DefaultValues is the empty dict, meaning 
that
                # no default values will be filled in.
                #self.DefaultValues['<field_name>'] = <value_or_function_object>

                # Default encoding is set to utf8, but if your backend db 
encodes in
                # something else, you need to set that encoding here (or in each
                # bizobj individually. A very common encoding for the Americas 
and
                # Western Europe is "latin-1", so if you are getting errors but 
are
                # unsure what encoding to pick, try uncommenting the following 
line:
                #self.Encoding = "latin-1"

        def getDisplayAmount(self):
            return "%.4D" % self.Record.amount


        def afterInit(self):
                super(B1, self).afterInit()

        def setBaseSQL(self):
                # Set up the base SQL (the fields clause, the from clause, 
etc.) The
                # UI refresh() will probably modify the where clause and maybe 
the
                # limit clause, depending on what the runtime user chooses in 
the
                # select page.
                self.addFrom("B1")
                self.setLimitClause("500")
                self.addFieldsFromDataStructure()

        def getColCaption(self, column):
                # if self.ColTextsDict is defined get the text from there, 
otherwise
                # just return the column name
                if self.ColTextsDict.has_key(column):
                        return self.ColTextsDict[column][0]
                else:
                        return column

        def getColToolTip(self, column):
                # if self.ColTextsDict is defined get the text from there, 
otherwise
                # just return the column name
                if self.ColTextsDict.has_key(column):
                        return self.ColTextsDict[column][1]
                else:
                        return column

        def getColHelpText(self, column):
                # if self.ColTextsDict is defined get the text from there, 
otherwise
                # just return the column name
                if self.ColTextsDict.has_key(column):
                        return self.ColTextsDict[column][2]
                else:
                        return column

The code compiles and runs but does not give me the 4 point precision I am 
looking for.

Thanks,

Tom
________________________________________
From: [email protected] [[email protected]] on behalf of 
Ed Leafe [[email protected]]
Sent: Tuesday, April 24, 2012 11:48 AM
To: Dabo Users list
Subject: Re: [dabo-users] Precision Value in Grid Column

On Apr 24, 2012, at 10:38 AM, RUSSELL Thomas wrote:

> Should I wait to use the fixed built in way or the virtual way?

        Depends on how quickly you need it.  ;-)

        I've made some progress on this, but haven't gotten it working yet. 
That's the one thing I was trying to finish before the next Web Update release, 
so with any luck I should get it done today.


-- Ed Leafe



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

________________________________
CONFIDENTIALITY : This e-mail and any attachments are confidential and may be 
privileged. If you are not a named recipient, please notify the sender 
immediately and do not disclose the contents to another person, use it for any 
purpose or store or copy the information in any medium.
_______________________________________________
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/3eb5c64f2911f841a886ac1d5ea8c356ba7...@041-db3mpn1-023.041d.mgd.msft.net

Reply via email to