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:
User | Time | Date | Label 1 | Input 1 |
User | Time | Date | Label 2 | Input 2 |
User | Time | Date | Label 3 | Input 3 |
User | Time | Date | Label 4 | Input 4 |
User | Time | Date | Label 5 | Input 5 |
Thanks in advance
Solved! Go to Solution.
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.
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
}
)
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.
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
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.