Reputation: 195
I have a list of events that are shown on "Events" page using a repeater. Each event is a page type and has a field "EventStartDateTime". I want to show only those events where the event start date is >= today. For now in the WHERE field in repeater,i am using the following condition:
(EventStartDateTime >= '{% DateTime.Now #%}') OR (EventStartDateTime = '')
But no data is visible on the page. So is it right ?
Any help will be greatly appreciated. Thanks
Upvotes: 0
Views: 532
Reputation: 6117
Your statement will work with a macro like so:
(EventStartDateTime >= '{% CurrentDateTime.ToShortDateString() %}')
Your second condition would not work because your EventStartDateTime
field is (assumed) to be a DateTime object so checking for an empty string will not work. You need to check for NULL
.
Upvotes: 1
Reputation: 247
I checked your code and it's kinda worked for me, but I will still modify it like this:
(EventStartDateTime >= GetDATE()) OR (EventStartDateTime IS NULL)
Because second part where you compare 'Date and time' field with empty string is not correct. So in your case, you don't get any data if 'EventStartDateTime' is not populated for every item. If that is not the case, you should try remove WHERE condition and check if you get data without it.
Best regards, Dragoljub
Upvotes: 1