Creating hierarchical entities from a single table...

Ric Turley <[email protected]> Mon, 10 Nov 2003 11:58:08 -0700
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <BBD52DD0.31C46%[email protected]>
I have a Timecard table with fields ID int, Date date, ProjectID int,
HoursWorked decimal, Activity varchar and EmployeeID int.  In the Timecard
entity there is also a derived field Week int.

I need to create access to the timecards for an employee in the form:

    Week ending 11/2/2003
        10/27/2003 (8.2 hours)
            Activity for Project this
            Activity for Project that
        10/28/2003 (4.0 hours)
            Activity for Project this
        10/29/2003 (3.8 hours)
            Activity for Project that
    Week ending 11/9/2003
        11/3/2003 (8.4 hours)
            Activity for Project this
            Activity for Project that

The old program creates nested collapsing lists with SQL commands like:
    SELECT <week_formula> as week, <week_end_formula> as week_end,
sum(hoursworked) FROM timecards WHERE employeeID=1 GROUP BY week ORDER BY
week     
    SELECT date, sum(hoursworked) FROM timecards WHERE week=893 AND
employeeID=1 GROUP BY date ORDER BY date
    SELECT concat(activity, ' for Project ', projectid) FROM Timecard WHERE
ID=4457

What is the best way to recreate this type of hierarchical list in EOF from
a single table?  

Thanks, 
Ric Turley
Zarac Software
Custom Software Development
http://www.zarac.com
Office: (303) 642-3106