On Mar 2, 2007, at 10:09 PM, Ken Dibble wrote:
> Thanks, Ed. I really wanted this to work, but it doesn't.
>
> Basically, putting that stuff in the setupBizobj() method causes
> the form
> not to run. The error is: "Form has no attribute 'keyBox'"
>
> Putting it in the selectSong() method, which gets called by the button
> onHit(), doesn't work either. I get "AttributeError: 'dBizobj'
> object has
> no attribute 'setWhere'"
OK, a couple of things. First, I goofed on the name of the method;
it should be either 'setWhereClause()' or 'addWhere()'. The former is
used when you want to override the existing WHERE clause; the latter
when you want to append another condition to the WHERE clause.
This is part of the bizobj setup, which only need be done once,
along with all the addField(), etc., calls. The setParams(), though,
is something that needs to be called when you are about to requery;
this sets the params to the current value that we want to search for.
Setting it when you set up the bizobj doesn't mean anything, because
even if the textbox had been instantiated (it won't), it would be empty.
I've modified your code to correct these problems; it follows my
sig. Try this and let me know how it goes.
-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
## *!* ## Dabo Code ID: dButton-dForm
def onHit(self, evt):
self.Form.selectSong()
## *!* ## Dabo Code ID: dForm-top
def afterInit(self):
self.setupBizobj()
def afterInitAll(self):
self.populateGrid()
def populateGrid(self):
self.gridKen.DataSource = "musSongs"
def selectSong(self):
# Try to show just one song in the thisSong textbox,
# assuming the user entered a number in the keyBox.
#myPK = self.keyBox.Value
# Neither of these lines for setParms() throws an
# error, but I assume only one can be right.
#self.PrimaryBizobj.setParams("%self.keyBox.Value%")
self.PrimaryBizobj.setParams(self.keyBox.Value)
self.requery()
def setupBizobj(self):
"""Set up the Bizobj"""
self.Application.addConnectFile("C:\DaboProjects\MyMusic
\mymusic.cnxml")
conn = self.Application.getConnectionByName("main")
biz = dabo.biz.dBizobj(conn)
biz.DataSource = "musSongs"
biz.KeyField = "pkid"
biz.addField("pkid")
biz.addField("songname")
biz.addField("compdate")
biz.addWhere("pkid = %s")
self.addBizobj(biz)
# If this is here, I get the first song in the table
# in natural order in the thisSong textbox. However,
# entering another number in the keyBox textbox and
# pressing the button STILL doesn't work.
#biz.requery()
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users