As we haven't managed to get the bizobj replace function to replace
anything, with or without scope, we decided to try the execute method with a
SQL
update statement:
bizRuns = self.Form.getBizobj("runs")
ThisRun = bizRuns.getFieldVal('run_no')
bizTubes = self.Form.getBizobj("tubes")
bizTubes.execute("update tubes set result = 'Invalid' where RUNfk = %s" %
ThisRun)
This works fine. Updates the values in the grid.
Adding bizTubes.saveAll() writes the changes to the database.
We then wrote our own replace function using execute and update that will
do a replace of a single value on current row, or multiple rows, depending
on parameters passed.
Is there anything wrong with this approach?
I realize that the SQL we send to the execute method would have to be
specific to whatever database is in use, in our case MySQL. So we lose the
"agnostic" quality of the dabo replace function. But what about other SQL
commands, like INSERT?
Here's the replace function.
def rpReplace(self,bizName,fldName,newVal,Multiple=None):
biz = self.getBizobj(bizName)
if Multiple is None:
PKname = biz.KeyField
ThisPK = biz.getPK()
biz.execute("update %s set %s = %s where %s = %s" % (bizName, fldName,
newVal, PKname, ThisPK ))
else:
biz.execute("update %s set %s = %s where %s " % (bizName, fldName, newVal,
Multiple ))
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
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]