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

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
Highlighted

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
Highlighted
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.

Highlighted

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

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (12,367)