cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nagaviswanath
Kudo Commander
Kudo Commander

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

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
Community Champion
Community Champion

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.

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,816)