I am trying to build a table of events on a cloud page. The normal table will remove events with a date that has a past date and this part is working fine.
The issue I am having is, if for some reason there are events within the DE that I'm pulling from but all are out of date, I want a message to say 'no upcoming events'
In messing around with it, i have got the message to display but it loops for the amount of events are in the table. Code below:
%%[ set @audience = "patient" Set @rows = Lookuporderedrows("Events_table_test",0,"date ASC","audience",@audience) set @rowCount = rowcount(@rows) for @i = 1 to @rowCount do SET @CurrentRow = Row(@rows,@i) SET @audience = Field(@currentrow,"audience") SET @date = Field(@currentrow,"date") SET @title = Field(@currentrow,"title") SET @location = Field(@currentrow,"location") SET @type = Field(@currentrow,"type") SET @today = NOW() set @days = DateDiff(@today, @date, "D") ]%% %%[if @rowCount > 0 and @days >= 0 then]%% <li class="event-listing %%=v(@type)=%% Event pb-4 pt-4"> <div class="row"> <div class="col-2"> <img src="" alt="" class="img-fluid"> </div> <div class="col-10 mt-2"> <p class="eventDate">%%=v(@date)=%%: %%=v(@location)=%%</p> <p class="eventTitle"> . <strong>%%=v(@title)=%% DAYS: %%=v(@days)=%% </strong></p> </div> </div> </li> </ul> %%[else]%% NO VALID EVENTS %%[endif next @i]%% </div> </div>