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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Records remaining to p...
Power Apps
Answered

Records remaining to patch

(0) ShareShare
ReportReport
Posted on by

Hello, 

 

I have an app where supervisors report the hours for their crews. I place the records in a temporary Collection until they are ready to save everything. 

 

Then using ForAll(temporaryCollection) I patch each row to an Excel file. 
Sometimes there can be many rows in the collection which means the saving will take time. I would like to see a number counting down after each row is saved. 

I have tried to place Update Context within the ForAll function, but that is not possible it seems. Basically I see ForAll as a For loop from i =1 to number of Rows. I would like to know what the current i is and display on the screen so the user knows that progress of the saving. 

 

Thank you in advance for any advice. 

Categories:
I have the same question (0)
  • v-bofeng-msft Profile Picture
    on at

    Hi @Anonymous :

    Do you want to display the number of remaining records that have not been added to the data source?

    Ive made a test for your reference:

    Step1:Add a button control

    On Select:

    Set(
     count1, /* a variable used to record the number of rows of the table after the operation is completed */
     CountRows(Table1) + CountRows(VarVarVar) /*Table1 is my data source, VarVarVar is the collection*/
    );
    Select(Timer1);
    ForAll(
     VarVarVar,
     Patch(
     Table1,
     Defaults(Table1),
     {
     cust_id: cust_id,
     cust_name: cust_name,
     saler_name: saler_name
     }
     )
    )

    Step2:Add a timer control.

    AutoStart: 

    true

    Duration: 

    10 /*loop in 0.01s*/

    OnTimerEnd:

    Set(
     count2, /* a variable used to record the number of remaining records that have not been added to the data source */
     count1 - CountRows(Table1)
    )

    Repeat: 

    true

    Visible:

    false

    Step3:Add a label control.

    Text: 

    count2

    The label control will display the number of remaining records that have not been added to the data source.

    In addition,since your data source is Excel, I suggest you pay attention to this following point(Main known limitations):

    1\You can only edit the formatted table that in the Excel file. Format the Excel data as a table

    2\If your Excel data includes a calculated column, you can't use it to build an app, and you cant add that data to an existing app.

    3\Sharing Excel tables

    In OneDrive for Business, share the file itself.

    In OneDrive, share the folder that contains the file, and specify file paths, not URLs, for any media.

    4\The maximum size of an Excel file that is supported by the Excel Online (OneDrive) connector is 5 MB.

    5\An Excel file may be locked in OneDrive for an update or delete up to 12 minutes(OneDrive) since the last use of the connector.

    6\You should not have the Excel workbook open in OneDrive when you are trying to update it, or you will receive the error The requested resource is locked.

     

    Best Regards,

    Bof

  • Community Power Platform Member Profile Picture
    on at

    Hello Bof, 

     

    Thank you for your help with my query. 

    A few follow up questions. Since Timer1, AutoStart:true it will run from the moment the screen is visible. 
    Will there be a performance impact from the call every 10 ms to CountRows of the Excel file? User may not click the save button for a awhile. 

    What is point in code of Select(Timer1) if timer has already started on opening of the screen? 

     

    Best regards, 

     

    Erik  

  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @Anonymous :

    Please try this solution

    Step1:Add a button control

    On Select:

     

    Set(
     count1,
     CountRows(Table1) + CountRows(VarVarVar)
    );
    UpdateContext({Start: true}); /*my custom variable to start the timer*/
    ForAll(
     VarVarVar,
     Patch(
     Table1,
     Defaults(Table1),
     {
     cust_id: cust_id,
     cust_name: cust_name,
     saler_name: saler_name
     }
     )
    );
    UpdateContext({Start: false}); /*stop timer*/
    Set(
     count2,
     0
    );

     

    Step2:Add a timer control.

    AutoStart: 

     

    false

     

    Duration: 

     

    500 /*loop in 0.5s*/

     

    OnTimerEnd:

     

    Set(
     count2, /* a variable used to record the number of remaining records that have not been added to the data source */
     count1 - CountRows(Table1)
    )

     

    Start:

     

    Start /*my custom variable*/

     

    Repeat: 

     

    true

     

    Visible:

     

    false

     

    Step3:Add a label control.

    Text: 

     

    count2

     

    The label control will display the number of remaining records that have not been added to the data source.

    Best Regards,

    Bof

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard