On Thursday 13 September 2007 04:21, Ed Leafe wrote: > On Sep 13, 2007, at 2:09 AM, johnf wrote: > > I believe the issue revolves around a recursive method Larry is > > attempting to > > write. The method adds/determines the cost for parent and children > > records > > and he is concerned that the objects he is recreating will use to much > > memory. Bottom line after obtaining the data (the cost in this > > case) the > > object is no longer needed. > > Without knowing the details of the process, this sounds like an > incorrect approach. The bizobjs when created should be added to the > form, which is then called to retrieve those instances as needed. > With the bizobj relationships set, the children should always be in > sync with the parents. I'd add a summing method to the bizobj classes: > > def sumCost(self): > i = self.bizIterator() > return reduce(lambda x,y: x+y, (b.Record.nCostField for bb in i)) > > ...where 'nCostField' is the column to be totalled. The total cost is > then calculated by iterating across the children: > > totalCost = reduce(lambda x,y: x+y, (kid.sumCost() for kid in > self.__children)) > > > -- Ed Leafe > -- http://leafe.com > -- http://dabodev.com Larry is using a dynamic bizobj to 1. allow the use of scan. 2. allow dynamic SQL statements based on the prior select statement.
I.e. : You start out with a Parent and you do not know how many children exist. And each child could have many children (or grand children of the parent). Than can continue for many levels. At each level other cost can be added. So at each level the cost can be different. And at each level there can be a different number of children. I don't understand your code enough to allow me to comment (I still call myself a newbie). But it still appears that a dynamic cursor is required to execute the select statement to determine if additional children exist. I much prefer not to use a bizobj. Larry, you could jump in here at any point! -- John Fabiani _______________________________________________ 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]
