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 / Updating label text an...
Power Apps
Answered

Updating label text and gallery after adding kilometers to SharePoint

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi there,

 

Currently I'm building an app where people can add kilometers they've ran to into our app. Based on everyone their kilometers saved in a SharePoint list we want to sum them all together and output it in a text label into the app.

 

Mitchelvdh_0-1617701147245.png

Sum(colEMails,distance) & " / 981"

 

Due to delegation issues, we are saving the results in a collection and display them in a gallery (items property) by the following code:

With(
 {
 wEmails: With(
 {
 wList: Sort(
 AddColumns(
 GroupBy(
 socialDistance,
 "Email",
 "ItemsByName"
 ),
 "distance",
 Sum(
 ItemsByName,
 Afstand
 ),
 "Emails",
 CountRows(ItemsByName)
 ),
 distance,
 Descending
 )
 },
 ForAll(
 Sequence(CountRows(wList)),
 Patch(
 Last(
 FirstN(
 wList,
 Value
 )
 ),
 {Ranking: Value}
 )
 )
 )
 },
 Sort(
 wEmails,
 distance,
 Descending
 )
)

 

Which results in:

Mitchelvdh_1-1617701412694.png

And save the data to SharePoint with a button (OnSelect property):

Patch(socialDistance,
 {
 Email: __AuditorEmail,
 Datum: txt_datum_2.SelectedDate,
 Afstand: Value(Txt_KM_2.Text)
 }
);

 

Gallery output:

Mitchelvdh_2-1617701562607.png

 

Everything is working fine, except that the labels and gallery doesn't refresh when adding new records. It does refresh when you switch to another screen and back. Somewhere reasonable since it re runs the gallery (which contains the filtering of the colEMails collection). 

 

I'm looking for a solution so it automatically refreshes the gallery and updates the colEMails collections.

 

If you need more information, feel free to comment below!

Categories:
  • Verified answer
    v-albai-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Unless you refresh DataSource manually, the App cannot find the new created record.

    To automatically refresh the DataSource in your App, you can use a Timer control.

    From the information you provided, seems that your gallery displays the data from collection colEMails, and this collection gets data from your SP list. If yes, you can simply add a Timer control to refresh your DataSource every 60 seconds, then your gallery will also display the refreshed data.

    See my example, try to enable “Repeat” and “Auto start” property of this Timer control, and set a Duration to the time you want to auto refresh(here, 60000 means 60s). Also, set OnTimerEnd property of this timer control to “Refresh(socialDistance) ”.

    v-albai-msft_0-1617777619411.png

    You can also disable the Visible property to hide this Timer.

    Best regards,

    Allen

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard