I'm trying to sort a series of events on an event page by their showtime but since each event can have more than one showtime I've used a multi-date picker datatype. I only want to sort based on the first showtime and display the nodes in that order but I'm having trouble figuring out the best way of doing this. Currently I've tried the following:
Since I donĀ“t know which package you are using for your Multi-Date Picker I would try to help you from the top of my mind. But what happen if you do something like this does this do any difference.
dynamic shows = Library.NodeById(1076).Children.OrderBy("eventDate descending").First();
foreach(var show in shows){
}
Or
dynamic shows = Library.NodeById(1076).Children;
foreach(var show in shows.OrderBy("eventDate descending").First()){
Sort by first date in Multi-Date Picker
I'm trying to sort a series of events on an event page by their showtime but since each event can have more than one showtime I've used a multi-date picker datatype. I only want to sort based on the first showtime and display the nodes in that order but I'm having trouble figuring out the best way of doing this. Currently I've tried the following:
dynamic shows = Library.NodeById(1076).Children.OrderBy("eventDate[0] descending");
foreach(var show in shows)
and
dynamic shows = Library.NodeById(1076).Children
foreach(var show in shows.OrderBy("eventDate[0] descending"))
but both of these throw errors.
Hi Anthony,
Since I donĀ“t know which package you are using for your Multi-Date Picker I would try to help you from the top of my mind. But what happen if you do something like this does this do any difference.
Or
Here are some documentation about the First() method. http://our.umbraco.org/documentation/Reference/Querying/DynamicNode/Collections#First%28%29
Hope this helps,
/Dennis
Thanks for the reply, I'm using UComponents. That solution is throwing the following error though "At least one object must implement IComparable."
is working on a reply...