cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted

How to bulk update multiple rows with 7 columns each using ForAll and Patch functions

Hello,

 

I am writing this as i cannot see any solution for this in the forum. I am trying to bulk update 5 rows each contains 7 columns with different values using ForAll and patch functions. However, it is getting updated with same value for all 5 rows.

 

My formula for Submit button:

ForAll(Timesheet,(Patch(TimeSheet_Week1,{Day: Value(TextBox8.Text),Worked: Value(TextInput1.Text),Vacation: Value(TextInput2.Text),Sick:Value(TextInput3.Text),Overtime: Value(TextInput4.Text),Client: TextInput5.Text,Location: TextInput6.Text},{Day: Value(TextBox10.Text),Worked:Value (TextInput7.Text),Vacation: Value(TextInput8.Text), Sick:Value(TextInput9.Text), Overtime:Value(TextInput10.Text), Client:TextInput11.Text, Location:TextInput12.Text},{Day: Value(TextBox16.Text),Worked:Value (TextInput13.Text),Vacation: Value(TextInput14.Text), Sick:Value(TextInput15.Text), Overtime:Value(TextInput16.Text), Client:TextInput17.Text, Location:TextInput18.Text},{Day: Value(TextBox17.Text),Worked:Value (TextInput19.Text),Vacation: Value(TextInput23.Text), Sick:Value(TextInput24.Text), Overtime:Value(TextInput25.Text), Client:TextInput21.Text, Location:TextInput22.Text},{Day: Value(TextBox18.Text),Worked:Value (TextInput31.Text),Vacation: Value(TextInput30.Text), Sick:Value(TextInput29.Text), Overtime:Value(TextInput28.Text), Client:TextInput26.Text, Location:TextInput27.Text}))

 

I have created TimeSheet collection which will be created by clicking on Save button.

 

UI of the app:

Patch_ForAll.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to bulk update multiple rows with 7 columns each using ForAll and Patch functions

Hello,

 

I am not using gallery option as it wont give much room for the user to see all details for the week at a time. And i think i have find out the solution for my problem. I have created code for SAVE button to get collection populated and used ForAll funtion to store the data from collection to the CDS.

 

Formula for Save button:

ClearCollect(TimeSheet,
{Day: Value(TextBox8.Text),Worked: Value(TextInput1.Text),Vacation: Value(TextInput2.Text),Sick:Value(TextInput3.Text),Overtime: Value(TextInput4.Text),
Client: TextInput5.Text,Location: TextInput6.Text},
{Day: Value(TextBox10.Text),Worked:Value (TextInput7.Text),Vacation: Value(TextInput8.Text), Sick:Value(TextInput9.Text), Overtime:Value(TextInput10.Text),
Client:TextInput11.Text, Location:TextInput12.Text},
{Day: Value(TextBox16.Text),Worked:Value (TextInput13.Text),Vacation: Value(TextInput14.Text), Sick:Value(TextInput15.Text), Overtime:Value(TextInput16.Text),
Client:TextInput17.Text, Location:TextInput18.Text},
{Day: Value(TextBox17.Text),Worked:Value (TextInput19.Text),Vacation: Value(TextInput23.Text), Sick:Value(TextInput24.Text), Overtime:Value(TextInput25.Text),
Client:TextInput21.Text, Location:TextInput22.Text},
{Day: Value(TextBox18.Text),Worked:Value (TextInput31.Text),Vacation: Value(TextInput30.Text), Sick:Value(TextInput29.Text), Overtime:Value(TextInput28.Text),
Client:TextInput26.Text, Location:TextInput27.Text})

 

Formula for Submit button:
ForAll(TimeSheet,(Patch(TimeSheet_Week1,
{Day:Day,Worked: Worked,Vacation: Vacation,Sick:Sick,Overtime: Overtime,
Client: Client,Location: Location})))

View solution in original post

2 REPLIES 2
Meneghino
Level 10

Re: How to bulk update multiple rows with 7 columns each using ForAll and Patch functions

Hi @Nagaviswanath

 

I think a simpler approach would be to use a gallery to display your time sheet text input boxes and use the day value as an index to write back to the data source with the date.

Also, it seems laborious to create a new data source for each week of reporting, or at least that is what it seems like from your code.

 

If you wish to explore this, please let me know.

Re: How to bulk update multiple rows with 7 columns each using ForAll and Patch functions

Hello,

 

I am not using gallery option as it wont give much room for the user to see all details for the week at a time. And i think i have find out the solution for my problem. I have created code for SAVE button to get collection populated and used ForAll funtion to store the data from collection to the CDS.

 

Formula for Save button:

ClearCollect(TimeSheet,
{Day: Value(TextBox8.Text),Worked: Value(TextInput1.Text),Vacation: Value(TextInput2.Text),Sick:Value(TextInput3.Text),Overtime: Value(TextInput4.Text),
Client: TextInput5.Text,Location: TextInput6.Text},
{Day: Value(TextBox10.Text),Worked:Value (TextInput7.Text),Vacation: Value(TextInput8.Text), Sick:Value(TextInput9.Text), Overtime:Value(TextInput10.Text),
Client:TextInput11.Text, Location:TextInput12.Text},
{Day: Value(TextBox16.Text),Worked:Value (TextInput13.Text),Vacation: Value(TextInput14.Text), Sick:Value(TextInput15.Text), Overtime:Value(TextInput16.Text),
Client:TextInput17.Text, Location:TextInput18.Text},
{Day: Value(TextBox17.Text),Worked:Value (TextInput19.Text),Vacation: Value(TextInput23.Text), Sick:Value(TextInput24.Text), Overtime:Value(TextInput25.Text),
Client:TextInput21.Text, Location:TextInput22.Text},
{Day: Value(TextBox18.Text),Worked:Value (TextInput31.Text),Vacation: Value(TextInput30.Text), Sick:Value(TextInput29.Text), Overtime:Value(TextInput28.Text),
Client:TextInput26.Text, Location:TextInput27.Text})

 

Formula for Submit button:
ForAll(TimeSheet,(Patch(TimeSheet_Week1,
{Day:Day,Worked: Worked,Vacation: Vacation,Sick:Sick,Overtime: Overtime,
Client: Client,Location: Location})))

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,993)