web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Gallery calculated fie...
Power Apps
Unanswered

Gallery calculated field update only happens on collection change after refresh?

(0) ShareShare
ReportReport
Posted on by 732

My data is stored in SQL so I have to do the workarounds for time.

 

I have a gallery that has a calculated label in it with this code

Text(Now() - First(ForAll(MatchAll(Text(ThisItem.MorningSigninTime),"PT(?:(?<hours>\d+)H)?(?:(?<minutes>\d+)M)?(?:(?<seconds>\d+)S)?"),Time(Value(hours),Value(minutes),Value(seconds)))).Value, "hh:mm")

The gallery items are

Sort(
 Search(
 Filter(
 Filter(
 '[dbo].[Today Activity Attendance]',
 'Grade Sort' < 0
 ),
 Not(IsBlank(MorningSigninTime)),
 IsBlank(SignoutTime)
 ),
 'Active Student Search'.Text,
 "NoAccentFirst",
 "NoAccentLast"
 ),
 MorningSigninTime,
 SortOrder.Ascending
)

Then I have a timer for every 10 seconds that OnTimerEnd is

Refresh('[dbo].[Today Activity Attendance]');Refresh('[dbo].[Today Activity Attendance Signed Out]')

The calculated time field only appears to update (recalculate) when the collection changes. It does not update on every refresh. Not sure how else I can force a refresh?

Categories:
  • Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    Instead of relying on the automatic refresh of calculated fields, you can directly reference the SQL data in your formula. Ensure that the data retrieved from SQL is correct and up-to-date. For example:

    Text(
     Now() - First(
     ForAll(
     MatchAll(
     Text(
     LookUp(
     '[dbo].[Today Activity Attendance]',
     ID = ThisItem.ID
     ).MorningSigninTime
     ),
     "PT(?:(?<hours>\d+)H)?(?:(?<minutes>\d+)M)?(?:(?<seconds>\d+)S)?"
     ),
     Time(Value(hours), Value(minutes), Value(seconds))
     )
     ).Value,
     "hh:mm"
    )

     

    Instead of just refreshing the data source, try refreshing the entire gallery or the specific item in the gallery. For example:

    Reset(Gallery1); // Replace Gallery1 with the actual name of your gallery

     

    Let me know if this helps

  • BrianHFASPS Profile Picture
    732 on at

    The SQL data isn't changing, it is recorded once a day. Even with the reset gallery it is only changing when the list in gallery changes.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 394 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

Last 30 days Overall leaderboard