Re: Implementing a pivot table / cross table
Re: Implementing a pivot table / cross table
- Subject: Re: Implementing a pivot table / cross table
- From: Lachlan Deck <email@hidden>
- Date: Fri, 17 Mar 2006 23:32:34 +1100
Hi there,
On 17/03/2006, at 10:19 PM, Jerry W. Walker wrote:
I've never implemented a cross table in WO (or in any other
environment, for that matter), but if, by cross table, you mean a
table used to statistically derive information about the
relationships between the row and column elements, then I question
doing it in WO at all.
Awe come on Jerry, stick with the programme: 'anything you can do WO
can do better' ;-)
If it's a statistical cross table, then the focus is on a table
which is easily implemented in an relational database.
Hmm. Just thinking out loud... I'd suppose, as with any problem
domain, that the focus is on the ultimate 'view' of the data. That
view we happen to call an Object. An Object (in theory) is oblivious
to where the data comes from that it receives.
So, the simple/default view (for most WO Apps) correlates to a single
row from a single table. i.e., an EOEnterpriseObject with properties
and relationships as defined in a corresponding EOEntity instance.
The info on the attributes and relationships are relevant to the view.
So, let's say we want a Cross-join (the Cartesian product of the
compared tables) that's akin to:
SELECT * FROM Actor CROSS JOIN Movie
The derived view will contain rows consisting of all columns from
Actor followed by all columns from Movie. That should mean that at
the point you know of the tables (err woops, I mean Entities) that
are to be involved in the cross-join (and in what order) you now have
the information necessary to dynamically build an EOEntity with the
corresponding attributes. All that's needed is
yourEOEntity,setExternalQuery("SELECT t0.name, etc....FROM Actor t0,
Moview t1");
But, at some point (when the database grows) you'll need to be able
to cull the list of results. Perhaps raw rows would be a better
approach...
with regards,
--
Lachlan Deck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden