web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : eov6EqBC/8sJBHXJmRPABS
Power Apps - Building Power Apps
Answered

Update SP List with values from same list using Patch

Like (0) ShareShare
ReportReport
Posted on 19 Aug 2023 02:49:21 by

nvpc_0-1692412359647.png

the patch is working but only updates yellow part from table a to the VACANCYID. How can I add the blue part from table b the VACANCYID also, i.e. IT0820230002.

 

ClearCollect(colTableA, Filter(TableA, Import = "Yes"));


ForAll(colTableA,
Patch(TableB ,LookUp(TableB, Available = "Yes"),
{ Title: colTableA[@PO].Value,
VacancyNumber: Concatenate(colTableA[@POSID], TableB.BillID), // this is not working, reason I don't know how to reference TableB fields

VacancyNumber: Concatenate(colTableA[@POSID], "test"), // works
Available: false
}

)
)

I have the same question (0)
  • hroudaadam Profile Picture
    22 on 19 Aug 2023 at 06:42:21
    Re: Update SP List with values from same list using Patch

    Hi there!

    First of all - do not use Patch + ForAll -> you can Patch multiple records at once (see https://www.matthewdevaney.com/patch-multiple-records-in-power-apps-10x-faster/).

    Now to your problem... I am no sure I understand you data. However here's an solution that comes to my mind...

    // patching multiple records at once
    Patch( 
     TableB,
     // when patching multiple record you only need columns with changes and with unique key
     ShowColumns(
     // add new column calculated from current and related collections
     AddColumns(
     colTableB,
     "VACANCYID",
     Concatenate(
     LookUp(colTableA, PO = ThisRecord.PO).POSID,
     ThisRecord.BILLID
     )
     ),
     "ID",
     "VACANCYID"
     )
    )

     

  • nvpc Profile Picture
    on 19 Aug 2023 at 21:45:18
    Re: Update SP List with values from same list using Patch

    Thank you for your reply, I've tried using your code and is not working.

    nvpc_0-1692481108014.png

    this first error (1st circle) says "A column name "VACANCYID" already exists, so I renamed it "VACANCYID1"

    I also change the PO (two other circles) to ID as PO is not unique. This cleared the errors and I was able to run but no results, see below

    nvpc_1-1692481506372.png

     

  • Verified answer
    nvpc Profile Picture
    on 20 Aug 2023 at 00:14:49
    Re: Update SP List with values from same list using Patch

    I managed to get this to work using the ForAll see bellow;

    before running code

    nvpc_0-1692490342091.png

    after running code

    nvpc_1-1692490441464.png

    ClearCollect(colImportedRecords, Filter(tableA, import = 1000));
    ForAll(colImportedRecords,
    Patch(TableB ,LookUp(TableB, AVAILABLE = true),
    { PO: colImportedRecords[@PO],
    VACANCYID: Concatenate(colImportedRecords[@POSID], LookUp(TableB, ID = colImportedRecords[@ID]).BILLID),
    AVAILABLE: false
    }
    )
    )

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 714 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 419 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 243

Last 30 days Overall leaderboard
Loading complete