Forum OpenACS Q&A: Re: how to select distinct events from calendar

Collapse
Posted by Don Baccus on
The recurrance_id in acs_events is shared for all the entries, so you could group on that and pick the minimum calendar_id to get the first entry for the recurring event.

Something like that, anyway, should give you a starting place.

You've hit one of the shortcomings of the calendar datamodel ... there should be one acs_event entry only and calendar item should be a many-to-one map of time descriptions to that single acs_event.

Someday we're going to rewrite this package ...

Collapse
Posted by Tom Lazar on
thanks again don,

one question, though: would it make sense (or is it even common practice?) to do the grouping in the .xql statement and THEN (re)-select from that in the .tcl file?

or can i have "nested" queries in the .xql file ala

  <fullquery name="grouped_events">
... select distinct recurrance_id, calendar_id from acs_events
....
</fullquery>

and then

  <fullquery name="single_events">
... select from grouped_events, acs_events
....
</fullquery>