Hi,
I'm trying to build a rotating notification bar in PowerApps which will show notifications / announcements based on start and stop date set in a SharePoint list.
This is my current setup:
SharePoint List -
Name: NotificationBar
Columns: Title, StartDate, EndDate
PowerApps -
Screen OnVisibleProperty:
ClearCollect(
FilteredNotifications,
Filter(
NotificationBar,
DateValue(StartDate) <= Today() && DateValue(EndDate) >= Today()
)
);
Label:
If(
CountRows(FilteredNotifications) > 0,
LookUp(
Filter(
FilteredNotifications,
DateValue(StartDate) <= Today() && DateValue(EndDate) >= Today()
),
ID = Mod(CurrentNotification, CountRows(FilteredNotifications)) + 1
).Title,
""
)
Timer with OnTimerEnd Property:
If(
CountRows(FilteredNotifications) > 0,
UpdateContext({ CurrentNotification: Mod(CurrentNotification + 1, CountRows(FilteredNotifications)) }),
UpdateContext({ CurrentNotification: 1 })
)
This is working, but the problem is i have 6 items in my SharePoint list. It shows the first 4 and the 5th is blank. then it starts back from item 1.
5th Item is future dated. 6th item is current Dated.
My end goal is to show notifications one at a time based in the start and end date.
Any help / guidance is appreciated.
Hi @Sarananthan ,
Looking into the formula on the Label:
If(
CountRows(FilteredNotifications) > 0,
LookUp(
Filter(
FilteredNotifications,
DateValue(StartDate) <= Today() && DateValue(EndDate) >= Today()
),
ID = Mod(CurrentNotification, CountRows(FilteredNotifications)) + 1
).Title,
""
)
For today 9/26/2023, items of ID 1-4 and 6 will be filtered and saved in the collection, so CountRows(FilteredNotifications) = 5, and while CurrentNotification = 4, Mod(4,5) = 4 so the criteria ID = 5 will get nothing from the collection. Then the next, Mod(5,5) = 0 so the next one is ID =1
I think you should not use LookUp function to get an item with specific ID but use
Last(FirstN(Filter(
FilteredNotifications,
DateValue(StartDate) <= Today() && DateValue(EndDate) >= Today()
), Mod(CurrentNotification, CountRows(FilteredNotifications)) + 1))
it will get the fifth item in the collection because Mod(4,5) +1 = 5, and the first/only one item in the collection because Mod(5,5) +1 = 1
Best regards,
Hi @Sarananthan ,
Could you please share the list data as an example? I really cannot understand the data source and how it's used in your App according to the formulas you provided.
Best regards,
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473