Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

How to prevent a collection being wiped when exiting the app to continue progress pt2..

(1) ShareShare
ReportReport
Posted on by 32
Firstly apologies this is a repost because I'm either not getting any further replies or the site is playing up.  I apparently got 2No answer at 6pm last night but nothing showing so not sure if replies were deleted or Microsoft still updating the site causing replies to have vanished...
 
I have built a Employee Time Entry app which as the user is entering each day it is added to a collection and they have a screen where they can review these entries in a gallery and when happy they submit it to a SharePoint list.  Some of the feedback I have been given is the users want to be able to enter a day and have the ability to exit the app then go in again next day to enter the following one but want to be able to see the previous day(s) too all before actually submitting anything to the SharePoint list.
 
From what I gather so far I need to set up another (in progress) SharePoint list with the same columns so they can save each day as they go but when they come back into the app need it to populate the collection with the previous data.  I think I need to have some formula in the OnStart property of APP but I'm unsure the correct formula to set this up to do this.  How can I do this?  They need to be able to add to this without wiping any existing data then once their full week is in there they can submit to the final SharePoint list.  they also need to only see their own data.
 
I can have an automation which archives the in progress data once the data has been submitted to the final list.
 
I added to OnStart for APP:
 
ClearCollect(
   YourCollection,
   YourListName
)
This still doesn't seem to be pulling anything from the list into the collection.
 
I have added this in to the OnStart property for APP but when I add a record into the app first post it to my InProgress list, exit the app and then when I go back in the record that was posted doesn't show in the gallery linked to the collection.  The record is showing in my list but it just doesn't seem to pull back to the collection.
 
I have some other formula already on the OnStart property of the app to add side menu, variable for the user and collection for working with time in the app and finally this new one I need at the bottom.  Do I need to structure my full formula differently to get this to work?  Formula below:
 
ClearCollect(
    colMenu,
    Table(
    {
        MenuLabel: "Home",
        MenuIcon: Icon.Home,
        MenuScreenNavigation: HomeScreen,
        MenuID: 1
    },
    {
 
        MenuLabel: "New Time Entry",
        MenuIcon: Icon.DocumentWithContent,
        MenuScreenNavigation: NewTimeEntry,
        MenuID: 2
    },
    {
        MenuLabel: "View Time Entries",
        MenuIcon: Icon.DetailList,
        MenuScreenNavigation: ViewTimeEntries,
        MenuID: 3
    },
    {
        MenuLabel: "Support",
        MenuIcon: Icon.Support,
        MenuScreenNavigation: Support,
        MenuID: 4
    }
)
);
Set(varUser, User().Email);
ForAll(Sequence(24,0), Collect(colHour, {Value: Text(ThisRecord.Value, "[$-en-US]00")}));
ForAll([0,15,30,45,60], Collect(colMinutes, {Value: Text(ThisRecord.Value, "[$-en-US]00")}));
 
ClearCollect(
    colTimeEntryWeek,
'TimeEntry-InProgress'
)
  • Suggested answer
    D_D Profile Picture
    107 on at
    How to prevent a collection being wiped when exiting the app to continue progress pt2..
    Hello,
     
    you can save and load collections to the local storage of a device.

    Here are the docs https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-savedata-loaddata

    SaveData( Collection, Name )
    LoadData( Collection, Name [, IgnoreNonexistentFile ])

    You can use those functions in combination with buttons to have a save and a load button.
     
    ---------------------------------------------------------------
    If this solved your question please mark this as an answer.
    Greetings David

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,708 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,030 Most Valuable Professional

Leaderboard