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
_______________________________________________
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]