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

How do you modify a set of records

This documentation here:

Modify or create a set of records in a data source

Patch( DataSource, BaseRecordsTable, ChageRecordTable1, [, ChangeRecordTable2, … ] )

  • DataSource – Required. The data source that contains the records that you want to modify or will contain the records that you want to create.

  • BaseRecordTable – Required. A table of records to modify or create. If the record came from a data source, the record is found and modified. If the result of Defaults is used, a record is created.

  • ChangeRecordTable(s) – Required. One or more tables of records that contain properties to modify for each record of the BaseRecordTable. Change records are processed in order from the beginning of the argument list to the end, with later property values overriding earlier ones.

 

I have 4 columns: ID, Name, FieldType, Active

I am not ADDING any records, only updating records.

When user toggle Active, I'm trying to add that item to a collection, like so:

 

Collect(EditedRows3, {ID: ThisItem.ID,Active: ThisItem.Active, FieldType: ThisItem.FieldType, Name: ThisItem.Name})

 

Then on the save button, I do this:

 

Patch('[dbo].[SnapShotFields]',EditedRows3);
Clear(EditedRows3)

 

but when running the Patch command, I am getting error message FieldType: Field Required

Every item I have has a field type already set, and it's included in the collection. Any suggestions what I am doing wrong?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: How do you modify a set of records

Hi @dave-jorgensen

Try this:

Patch('[dbo].[SnapShotFields]', ShowColumns(EditedRows3, "ID"), EditedRows3)

This is because you need the second parameter to identify which records need to be modified.

I am assuming that ID is the primary key of your table.

 

Please let me know

View solution in original post

3 REPLIES 3
Highlighted
Community Champion
Community Champion

Re: How do you modify a set of records

Hi @dave-jorgensen

Try this:

Patch('[dbo].[SnapShotFields]', ShowColumns(EditedRows3, "ID"), EditedRows3)

This is because you need the second parameter to identify which records need to be modified.

I am assuming that ID is the primary key of your table.

 

Please let me know

View solution in original post

Advocate IV
Advocate IV

Re: How do you modify a set of records

Thanks so much!

Highlighted
Community Champion
Community Champion

Re: How do you modify a set of records

You are welcome, please visit my blog:

https://baizini-it.com/blog/

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,011)