I'm trying to make a macro that displays all events/entries using getEvents but limit the results to a number (controlled by a macro parameter) as well as a property value on the actual entry.
Apparently I can't use .Where() on the collection?
BUT, I want to limit this even more to only events that have the checkbox calFeatured checked. I tried events.Where("calFeatured = true").Take(eLimit) but it errors and says KS.Umbraco7.Calendar.Core.CalendarEvent does not contain a definition for Where. I know this probably wouldn't work anyway as I'd have to do something like item.content.GetPropertyValue("calFeatured") = true or something, but how do I do that in a Where clause and how do I stack that before the Take()?
Basically, I want all events that have the bool property calFeatured checked but then limited to the latest int controlled via a macro property. I can do one or the other, but not both in the correct order.
Is there a better way to do what I want? I'm new to razor and C#... I'm learning as I go but my real strength is Frontend so this is all very foreign to me.
Limit List by Number and Property Value
I'm trying to make a macro that displays all events/entries using getEvents but limit the results to a number (controlled by a macro parameter) as well as a property value on the actual entry.
Apparently I can't use .Where() on the collection?
This is what I have right now and it works:
BUT, I want to limit this even more to only events that have the checkbox
calFeatured
checked. I triedevents.Where("calFeatured = true").Take(eLimit)
but it errors and saysKS.Umbraco7.Calendar.Core.CalendarEvent does not contain a definition for Where
. I know this probably wouldn't work anyway as I'd have to do something likeitem.content.GetPropertyValue("calFeatured") = true
or something, but how do I do that in a Where clause and how do I stack that before theTake()
?Basically, I want all events that have the
bool
propertycalFeatured
checked but then limited to the latestint
controlled via a macro property. I can do one or the other, but not both in the correct order.Is there a better way to do what I want? I'm new to razor and C#... I'm learning as I go but my real strength is Frontend so this is all very foreign to me.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.