cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SteveJebson
Frequent Visitor

Patch a record within a record in a Collection

Hi,

 

I'm trying to patch a record within a record within a collection and can't find the right syntax to update it ?

 

The unique key in colData is JoblineID and the unique key in the JoblineADrecord is ID

 

Trying to just hardcode the update but can;'t get the syntax right....

Patch(colData,{JoblineID:1124123},{JoblineADrecord.ID:1124123,Status:"xxx"});

 

colData.jpgJoblineADrecord.jpg

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @SteveJebson,

Based on the issue that you mentioned, do you want to update a nested table within a collection?

Could you please share a bit more about the scenario?

The Patch function could only be applied to your original data source (e.g. a SP List, a SQL Table, a first level Collection, ...etc), it could not be used to update a column value inside nested collection.

Not sure how you create the colData, based on a data source like SP list or create it with hard code?

If you have an original data source, as an alternative solution, you could consider find the specific record you want to update from your original data source (e.g. a SP List), and then update the specific record, then group your original data source again based on some columns. So please consider try the following formula (set the OnSelect property of a button to following:

Patch(
         'Your Original Datasource',
         LookUp('Your Original Datasource', ID = 1124123), // Find the record you want to update in your orginal data source
         {
           Status : "Type Specific Value Here"
         }
);
// Re-group your original data source based on several columns again
ClearCollect(
             colData,
             GroupBy('Your Original Datasource', "JoblineADrecord", "JoblineID", "Status", ...)
)

Hope it could help you.

Regards,

Qi

 

 

Best Regards,
Qi

View solution in original post

2 REPLIES 2
MatthewInwards
Resolver II
Resolver II

Your patch will look something like this:

Patch(
    colData,
    First(Filter(colData,JoblineID = 1124123)),
    {
        [PATCH_INFO_GOES_HERE]
    }
)
v-qiaqi-msft
Community Support
Community Support

Hi @SteveJebson,

Based on the issue that you mentioned, do you want to update a nested table within a collection?

Could you please share a bit more about the scenario?

The Patch function could only be applied to your original data source (e.g. a SP List, a SQL Table, a first level Collection, ...etc), it could not be used to update a column value inside nested collection.

Not sure how you create the colData, based on a data source like SP list or create it with hard code?

If you have an original data source, as an alternative solution, you could consider find the specific record you want to update from your original data source (e.g. a SP List), and then update the specific record, then group your original data source again based on some columns. So please consider try the following formula (set the OnSelect property of a button to following:

Patch(
         'Your Original Datasource',
         LookUp('Your Original Datasource', ID = 1124123), // Find the record you want to update in your orginal data source
         {
           Status : "Type Specific Value Here"
         }
);
// Re-group your original data source based on several columns again
ClearCollect(
             colData,
             GroupBy('Your Original Datasource', "JoblineADrecord", "JoblineID", "Status", ...)
)

Hope it could help you.

Regards,

Qi

 

 

Best Regards,
Qi

View solution in original post

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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