On Nov 30, 2006, at 8:39 AM, Ed Leafe wrote:

>       So what I tend to do is rather than construct some unwieldy SQL
> statement, I retrieve the fields I want, and then write Python
> functions that do the complex stuff on the resulting data set. So
> here's an example:
>
> def someComplexStuff(val):
>       val = val.strip()
>       if val.startswith("Z"):
>               val = val[2:].lower()
>       elif len(val) > 14:
>               ...
>       ...
>       return val
>
> biz.requery()
> biz.replace("myField", "=someComplexStuff(myField)")

        Sorry, after I posted this I realized that it wouldn't work as  
written. In this case, 'someComplexStuff' would not be in the  
namespace where the replace happens. I use something like  
'self.Application.method()', or some other universally-available  
reference, since the actual execution is carried out in the dDataSet  
object, which doesn't 'know' about stuff defined in the bizobj.

        You know, I hadn't played with this in a while, but now that I'm  
looking at the code again, I can see a way to add automatic  
references to the cursor and bizobj that 'owns' a particular data set  
so that you could easily use methods of those two objects. I think  
I'll add them now!

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to