Listing current events and events with no date

Romina Herrera asked on July 11, 2016 22:12

Hello, I am using the following WHERE condition to only list current events in my events calendar

(EventDate >= '{% DateTime.Now #%}')

Some events that occur on a weekly basis, we don't put in an event date at all. I would like these events (with no date) to be listed as well.

How to include this in the WHERE condition?

Correct Answer

Bryan Soltis answered on July 11, 2016 22:18

Hi Romina,

This sounds like a simple SQL statement update. If your EventDate field accepts NULL and you are not populating it, it would be:

(EventDate >= '{% DateTime.Now #%}') OR (EventDate IS NULL)

If you are populating the field, but with an empty value it would be:

(EventDate >= '{% DateTime.Now #%}') OR (EventDate = '')
  • Bryan
0 votesVote for this answer Unmark Correct answer

Recent Answers

Romina Herrera answered on July 29, 2016 19:34

Hello Bryan, thanks for your help earlier on resolving this, but I've run into another snag. I use this WHERE condition so that the repeater can load pages that use the same Categories as the current page.

([NodeID] != {% NodeID %}) AND ([DocumentID] IN (SELECT [DocumentID] FROM [CMS_DocumentCategory] WHERE [CategoryID] IN (SELECT [CategoryID] FROM [CMS_DocumentCategory] WHERE [DocumentID] = {% DocumentID %})))

and trying to combine it with the previous WHERE condition to show only current and future events has been proven a challenge.

The desired behavior for the repeater would be: Show only items that match the category of the page currently on, are not older than today's date or have no date specified.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.