cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RamiGamal
Frequent Visitor

Collect same data and record it in multiple lines

Hello experts,

 

I have a page in my app that has 5 inputs and I created a button to collect these inputs in a SharePoint list with a sample code:

 

Collect(SPLIST,{User:User().FullName,Date:Now(),Time:Now(),Description:Label1.Text,Duration:Dropdown1.Selected.Value}
,Collect(SPLIST,{User:User().FullName,Date:Now(),Time:Now(),Description:Label2.Text,Duration:Dropdown2.Selected.Value}
,Collect(SPLIST,{User:User().FullName,Date:Now(),Time:Now(),Description:Label3.Text,Duration:Dropdown3.Selected.Value}
,Collect(SPLIST,{User:User().FullName,Date:Now(),Time:Now(),Description:Label4.Text,Duration:Dropdown4.Selected.Value}
,Collect(SPLIST,{User:User().FullName,Date:Now(),Time:Now(),Description:Label5.Text,Duration:Dropdown5.Selected.Value}

 

 The problem is that this code repeat the same action with the same data for the five lines and add only inputs which takes much time in processing.

So how to collect the standard data (time, user, date) one time only and record it in the 5 lines along with the inputs so the final outcome to be:

UserTimeDateLabel 1Input 1
UserTimeDateLabel 2Input 2
UserTimeDateLabel 3Input 3
UserTimeDateLabel 4Input 4
UserTimeDateLabel 5Input 5

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
RamiGamal
Frequent Visitor

I finally did it !, and managed to reduce the collect process of one of my screens that was used to create 32 lines from ridiculous 10 mins that was making the app unusable to just 1-2 seconds.

I am leaving how I did it here in case it can help someone with the same inquiry.

First I converted all my "collect" function to "Patch" function then I used "Concurrent" function to perform all the patching simultaneously instead of doing the patching in series so it is like I you are patching one line only.

View solution in original post

5 REPLIES 5
v-qiaqi-msft
Community Support
Community Support

Hi @RamiGamal,

Do you want to save all the inputs from those 5 labels and 5 dropdown boxes to your SP list?

 

If so, modify your formula as below:

Collect(
    SPLIST,
    {
        User:User().FullName,
        Date:Now(),
        Time:Now(),
        Description:Label1.Text,
        Duration:Dropdown1.Selected.Value
    },
    {
        User:User().FullName,
        Date:Now(),
        Time:Now(),
        Description:Label2.Text,
        Duration:Dropdown2.Selected.Value
    },
    {
        User:User().FullName,
        Date:Now(),
        Time:Now(),
        Description:Label3.Text,
        Duration:Dropdown3.Selected.Value
    },
    {
        User:User().FullName,
        Date:Now(),
        Time:Now(),
        Description:Label4.Text,
        Duration:Dropdown4.Selected.Value
     },
     {
        User:User().FullName,
        Date:Now(),
        Time:Now(),
        Description:Label5.Text,
        Duration:Dropdown5.Selected.Value
     }
)

Best Regards,
Qi

Hi V,

I am actually doing this currently but the action takes much time as it collects the same data more than one time so my is there is anyway like to collect the fixed data (User, date & time) once, then collect the inputs to reduce the action duration.

Thanks.

Hi @RamiGamal

If you want to patch 5 records at the same time, I think there is no much more efficient way.

Even though we could patch the same 5 records for the same (User, date & time) once, we still need to batch update.

 

Unless you disassembly steps to finish this job, however I think this obviously cost time.

Best Regards,
Qi

Hi @v-qiaqi-msft ,

 

Thanks for your reply, Do you recommend a work around or may be change in the collection/patch way in order to accelerate the process, as in some pages I have like 15 lines to be created which takes approximately about 5 mins or something.

Else can I run this process in the background so the user don't need to wait for this process to complete

RamiGamal
Frequent Visitor

I finally did it !, and managed to reduce the collect process of one of my screens that was used to create 32 lines from ridiculous 10 mins that was making the app unusable to just 1-2 seconds.

I am leaving how I did it here in case it can help someone with the same inquiry.

First I converted all my "collect" function to "Patch" function then I used "Concurrent" function to perform all the patching simultaneously instead of doing the patching in series so it is like I you are patching one line only.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,328)