On Aug 31, 2007, at 11:18 PM, dw wrote:
> I apologize. The originally posted debug output was from a
> different error. The
> actual error is the same as is generated with the altered
> dDataControlMixinBase.py file. When SQL Builder constructs the
> query and the field alias 'phType' is added,
> field 'phType' is found in the dataset. When the same SQL is
> constructed
> manually and UserSQL is invoked, the field alias 'phType' is not
> found in the
> dataset, although it is created in the query :
>
> testsql = """Select FotoInf.count0, FotoInf.recordID_fk,
> FotoInf.FInfoID_fk,
> InfoPT.photoType as phType From FotoInf inner join InfoPT on
> FotoInf.FInfoID_fk = InfoPT.InfoID"""
I'm stumped. I just used the Class Designer to create a form, and
create a grid on it using the Data Environment wizard as you did. I
used a connection file to an SQLite database that I use for tracking
suspicious IP addresses that hit my server. I changed the DataField
for a column to an alias that didn't exist in the table, and then
changed the generated bizobj code to delete the SQL Builder stuff,
and define the UserSQL to include the aliased field. Here's the
bizobj code:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def createBizobjs(self):
class IphitsBizobj(dabo.biz.dBizobj):
def afterInit(self):
self.DataSource = "iphits"
self.KeyField = "pkid"
self.UserSQL = """select pkid, hittime, ipaddress as
crappo
from iphits
order by hittime desc"""
def validateRecord(self):
"""Returning anything other than an empty string from
this method will prevent the data from being saved.
"""
ret = ""
# Add your business rules here.
return ret
iphitsBizobj = IphitsBizobj(self.Connection)
self.addBizobj(iphitsBizobj)
def afterInitAll(self):
self.requery()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The grid column that was originally created with a DataField of
'ipaddress' was changed so that it now had DataField = "crappo". I
ran the design, and everything appeared as expected. From the running
design, I pressed Cmd-D to bring up a command window, and typed
'print self.PrimaryBizobj.getDataSet()', and the output showed a
series of rows, each of which had a key named 'crappo'.
Is it possible that SQLite is changing the case of the alias name?
Try this: right after your self.requery(), add the line:
print self.PrimaryBizobj.getDataSet()[0].keys()
...in order to see what the fields in your data set are actually named.
-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
_______________________________________________
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]