I need some help creating a virtual field with data from another virtual
field.
I have a table with start and end times. I have created a virtual field
called duration which is calculated as endtime minus starttime to give me a
duration in seconds.

This works no problem.

Now I want to create another virtual field called projectDuration which
would be the sum of all the durations for each project.

Looking over the forums I found what I think would do the job, but I can't
for the life of me, get it to work.

Here is what I found in the forum:

[quote]
If you child bizobjs have a method or *virtual* *field* that returns
their total, the easiest way to get the total of all the children
would be:

        tot = sum([kid.subtotal for kid in self.__children])
[/quote]

The only difference for me is that it is the main bizobj and not a child.

Here is what I tried in my bizobj file (app/biz/Records.py)

self.VirtualFields = {"duration": self.getDuration, "projDuration":
self.getDurationProject}

    def getDurationProject(self):
        project = self.Record.projName
        projDuration = sum([project.duration for project in self._records])
        return int(projDuration)

I get the following error:

File "/home/theedo/Programs/Dabo/timeReporting/biz/Records.py", line 83, in
getDurationProject
    projDuration = sum([project.duration for project in self._records])
AttributeError: 'Records' object has no attribute '_records'


Can anyone shed some light on this?

All pointer are greatly appreciated.

Thanks in Advance
Carey


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

Reply via email to