On Feb 28, 2009, at 2:28 AM, tim awa wrote:
> How do I specify the UserSQL equivalent of the following:
>
> self.DataSource = "tblphone"
> self.KeyField = "pkid"
> self.LinkField = "fkname"
> self.addFrom("tblphone")
> self.addField("phone")
>
> When the parent record pointer changes, the child table is requeried
> and I
> do not know how to do the WHERE clause part.
>
> self.DataSource = "tblphone"
> self.KeyField = "pkid"
> self.UserSQL = """select phone from tblphone where fkname=??????"""
>
> My actual SQL Selects are complex and I prefer to do UserSQL rather
> than the
> alternative line-by-line specification if at all possible.
You can specify the where clause using a parameter; then all you have
to do is override the getParams() method to return a tuple containing
the parent's key value. E.g.:
self.UserSQL = """select phone from tblphone where fkname=%s"""
...
def getParams(self):
fk = self.Parent.Record.fkname
return (fk, )
-- 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]