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 / Store settings locally...
Power Apps
Answered

Store settings locally - force update when app is published

(0) ShareShare
ReportReport
Posted on by 26

I have an app that loads 4 separate tables which store items for the corresponding dropdowns in the app.  The reason I have done this is that after the first load, the app loads a lot quicker by not having to go and get the table data from SQL.  This table data will hardly ever change.... but, if it does change I want to be able to force an update of the tables when the app is next published. the intension is that the app will see that it is newly updated, and go and update the local saved data and therefore be up to date.  

 

I'm struggling with how to do this.  I can do it manually by creating a button that the user would have to click, but they would need to be advised to go and do that.

 

Does anyone have an idea on how I could achieve this. Is there a setting "App updated" or something that I could hook into.

Thanks in advance

Stu

 

Categories:
  • Verified answer
    mdevaney Profile Picture
    29,993 Moderator on at

    @StuCrooks 
    I would suggest creating a new table called App Cache.  Then store the current app version inside it.

    Title Value
    App Version 1.1



    Then set a variable in the app's OnStart property to track the current version.  Use an IF statement to determine whether the app should load from local data or the database.

    Set(gblAppVersion, "1.0");
    If(
     LookUp('App Cache', Title="App Version", Value)=gblAppVersion,
     LoadData(your_table_name),
     ClearCollect(your_table_name);
     SaveData(your_table_name)
    )

     


    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • StuCrooks Profile Picture
    26 on at

    Hi @mdevaney 

    Thanks for the quick reply.  This could work.. however, I'm still trying to get my head around your answer.  Where does the table sit?  Also, how would I control so that the user only sync's the data 1 time, until the next update of course.

    Stu

  • StuCrooks Profile Picture
    26 on at

    This is what I ended up doing. 

    Step 1. The first section uses the PowerAppsforMakers data connector.  You need to add this in connectors first.  This basically counts the number of saved/published versions of the app.  Courtesy of @Anonymous. 

     

    Step 2. Then I used a bit of a variation of the above from @mdevaney .

     

    In app.startup..

    ClearCollect(myAppVersions, PowerAppsforMakers.GetAppVersions("APPID"));
    ClearCollect(myAppVersionsv2,Ungroup(myAppVersions,"value"));
    ClearCollect(myAppVersionsv3,Filter(myAppVersionsv2, properties.lifeCycleId = "Published"));
    Set(AppVersion, CountRows(myAppVersionsv3));

     

    //load data from the offline collection if there is any
    LoadData(OfflineAppVersion,"OfflineAppVersion",true);
    Set(LocalAppVersion, Value(First(OfflineAppVersion).Value));

     

    // check if the appversion matches the local saved version and if so, load data from local cache
    If(LocalAppVersion <> AppVersion, 
    // ... do the stuff you want to do as well, like update the offline tables etc...
    // then update the offline collection
    ClearCollect(OfflineAppVersion,  AppVersion);
    //set the value of the local app version to the new app version
    SaveData(OfflineAppVersion,"OfflineAppVersion")
    )

     

    Cheers

    Stu

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