OK, I am not 100% sure about the inner/outer thing as I'm not really an SQL guy. From what I understand, an inner is essentially the same as select * from booking b, performance p where b.performanceid = p.id
or
select * from booking b inner join performance p on b.performanceid = p.id
whereas outer would include all the performances regardless of whether there is a match.
Are you saying such a sort ordering should use an outer join? (which from my understanding includes all the performances whether or not they match this booking?) In this case, as PerformanceType is basically a lookup table with 3 rows, I'd want to sort on all the bookings on a given date, based on the booking's performance's performanceType, in descending order of the performanceType's displayOrder.
As I obviously want to be able to ask a performance what it's performanceType is, I'd presumably only want to match the to-one performanceType for that performance, and not all of them, so I'm not clear how I should change this.
My current running code: public NSArray<Booking> upcomingEvents() { NSTimestamp now = new NSTimestamp(); EOSortOrdering dateOrdering = Booking.EVENT_DATE.asc(); NSArray<Booking> events = Booking.fetchBookings(editingContext(), Booking.EVENT_DATE.after(now).and(Booking.EVENT_DATE.before((NSTimestamp)now.timestampByAddingGregorianUnits(0, 0, daysAhead, 0, 0, 0))), new NSArray<EOSortOrdering>(dateOrdering));
sorts all the bookings including acts on a given date that are of 3 different type, but (obviously) only on eventDate (so the headliner might not appear above the feature, or specialEvent
While:
public NSArray<Booking> upcomingEvents() { NSTimestamp now = new NSTimestamp(); EOSortOrdering dateOrdering = Booking.EVENT_DATE.asc(); EOSortOrdering performanceTypeOrdering = Booking.PERFORMANCE.dot(Performance.PERFORMANCE_TYPE.dot(PerformanceType.DISPLAY_ORDER)).desc();
NSArray<Booking> events = Booking.fetchBookings(editingContext(), Booking.EVENT_DATE.after(now).and(Booking.EVENT_DATE.before((NSTimestamp)now.timestampByAddingGregorianUnits(0, 0, daysAhead, 0, 0, 0))), new NSArray<EOSortOrdering>(dateOrdering, performanceTypeOrdering));
return events; }
Sorts, appropriately, but for some reason leaves out the feature completely.
The relationship from booking -> performance is a to one, then from performance -> performanceType is also a to one, and the reverse relationships are all inner joins currently. (e.g. I want the performance asso On Dec 1, 2010, at 10:10 PM, Chuck Hill wrote: On Dec 1, 2010, at 6:56 PM, Andrew R. Kinnie wrote:
OK, well I did that, and even re-booted the machine. No change.
In other news if I eliminate my second sort ordering, the previously missing booking appears.
That sounds like maybe you have a inner join where you want an outer join.
I changed it to use ERXSortOrdering and get the same result.
I need a beer.
Under these circumstances I'd suggest BrennivĂn and lots of it. I'll leave the inclusion of fermented shark to your own discretion.
Chuck
|