Hello:
I have used the Class Designer with a sqlite3 database to create a grid that
displays the look up value
that corresponds to foreign key value, as described in archived posts and the
Wiki. When I use the
SQL Builder to create the query which contains a field alias, things display
properly. When I create the identical
SQL statement manually and utilize UserSQL, I generate an error. The manual SQL
statement works when I run it
directly against sqlite3 and the database. I am interested in using UserSQL and
manual SQL statements rather
than SQL Builder, in order to create SQL statements that contain Table aliases.
SQL Builder does not seem to
allow Table aliases although it does permit field aliases.
I am running Windows XP Pro SP2, Python Version: 2.4.4 on win32, Dabo Version:
Version 0.9a; Revision 3335,
UI Version: 2.8.1.1 on wxMSW and SQLite version 3.3.12.
The generated error is:
Traceback (most recent call last):
File "C:\projects\dabo\lib\eventMixin.py", line 97, in raiseEvent
bindingFunction(event)
File "C:\projects\dabo\ui\uiwx\dPemMixin.py", line 1155, in __onUpdate
self.update()
File "C:\projects\dabo\ui\dDataControlMixinBase.py", line 109, in update
self.Value = method()
The functioning code is:
/**********works****************/
class FotoinfBizobj(dabo.biz.dBizobj):
def afterInit(self):
self.DataSource = "FotoInf"
self.KeyField = "count0"
self.LinkField = "recordID_fk"
self.addFrom("FotoInf")
self.addField("recordID_fk")
self.addField("FInfoID_fk")
self.addField("count0")
self.addJoin("InfoPT", "FotoInf.FInfoID_fk=
InfoPT.InfoID")
self.addField("InfoPT.photoType as phType")
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
fotoinfBizobj = FotoinfBizobj(self.Connection)
self.addBizobj(fotoinfBizobj)
fotoinfBizobj.setLimitClause(None)
recnameBizobj.addChild(fotoinfBizobj)
The code that generates the error is:
/******************does not work***********************************/
class FotoinfBizobj(dabo.biz.dBizobj):
def afterInit(self):
self.DataSource = "FotoInf"
self.KeyField = "count0"
self.LinkField = "recordID_fk"
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
fotoinfBizobj = FotoinfBizobj(self.Connection)
self.addBizobj(fotoinfBizobj)
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"""
fotoinfBizobj.UserSQL= testsql
fotoinfBizobj.setLimitClause(None)
recnameBizobj.addChild(fotoinfBizobj)
thank you,
dwarder
_______________________________________________
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]