Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Patch and Array

(0) ShareShare
ReportReport
Posted on by 170

Hi!

 

I have a collection MainData3 with 4 fields: CounterParties, Expenses, Sum, Number

shnurich_0-1625476242654.png

And CounterParties its an array:

shnurich_1-1625476284287.png

I create a gallery for MainData3 and a second gallery2 into for ThisItem.CounterParties.

 

I would like to add and delete into one item some counterParties
And try it, but it just update one Counterparty.
Patch(MainData3;LookUp(MainData3;Expence=ThisItem.Expence);{CounterParties: {Name: ComboBox9.Selected.CounterPartyName}})

How to add new CounterParty to CounterParties Array correctly and how delete separatly from this Array?

 

  • camchiltonVA Profile Picture
    6 on at
    Re: Patch and Array

    Hi all, I just encountered the same issue as described above. I'm attempting to build a new json object with updated properties to be saved to a sharepoint list. I'm defining a new object to add to an existing collection:

    // add CDE-id module to jsonAccessConfig field
    Set(newCDEmodule,
     {
     id:"CDEID",
     roles:["EDITOR"],
     portfolios:[],
     providers:[],
     reasonForAccess:"test",
     approvalStatus:"APPROVED"
     }
    );
    
    Clear(collFinalCDEmodules);
    // convert new record to a table
    ClearCollect(collFinalCDEmodules, newCDEmodule);
    // trying to get values of roles array
    Set(rolesArray, collFinalCDEmodules.roles);
    
    ForAll(
     collFinalCDEmodules,
     Patch(
     collUserJsonModules,
     Defaults(collUserJsonModules),
     {
     id: collFinalCDEmodules[@id],
     //roles: collFinalCDEmodules[@id], // this line is the issue, what is the syntax to Patch an array here?
     approvalStatus: collFinalCDEmodules[@approvalStatus],
     reasonForAccess: collFinalCDEmodules[@reasonForAccess]
     }
     )
    );
  • CU09100753-0 Profile Picture
    170 on at
    Re: Patch and Array

    Guys, please help:)

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,605 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,946 Most Valuable Professional

Leaderboard