search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Scheduler: Get events for a given resource

Asked by David Taylor
12 years ago.

Is there a way to determine whether a given resource has any events associated with it (apart from going back to the database server-side) ? I'm trying to determine whether I can remove a resource row because there are no longer any events assigned to it.

Answer posted by Dan Letecky [DayPilot]
12 years ago.

On the client-side, you can do the following:

var hasEvents = dps.findRowByResourceId("A").events.length > 0;

On the server side, there is no internal structure that keeps events matched to the resources. You would have to go through the data source (you can reuse what you assign to DataSource property, so you don't have to load everything from the database twice).

See also the following tutorial that filters resources depending on the associated events. It works the other way - i.e. it shows only the free rows but you should be able to adjust the SELECT command as needed:

http://code.daypilot.org/34704/restaurant-table-reservation-tutorial-asp-net-c-vb-net

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.