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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch non existing rec...
Power Apps
Answered

Patch non existing records into another list

(0) ShareShare
ReportReport
Posted on by 11

Hi everyone, I hope you can help me with my problem. I have a Training completion tracker app in Powerapps. 
List A = contains all required trainings to be taken by the users
List B = serves as data storage for all users with their trainings coming from List A. 

I have a collection (mytrainings) which contains record from a "List A".

Now I want to patch 'mytrainings' collection into List B via a button, but only patched those new trainings, and will not duplicate entries.

Here is my code:
ClearCollect(
myTrainings2,
'training-poc-lists'
);

ForAll(
myTrainings,
Patch(
'training-poc-lists-users',
Defaults('training-poc-lists-users'),
{
Title: myTrainings[@Title],
Description: myTrainings[@Description],
Deadline: myTrainings[@Deadline],
Duration: myTrainings[@Duration],
'Training Status': myTrainings[@Status],
Thumbnail: myTrainings[@Thumbnail],
User: LabelUser.Text
}
)
);

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,756 Most Valuable Professional on at

    Hi @tamilkyway ,

    Assuming Title is the unique value field here

    ForAll(
     Filter(
     myTrainings,
     IsBlank(
     LookUp(
     'training-poc-lists-users' As aList,
     aList.Title = Title
     )
     )
     ) As aPatch,
     Patch(
     'training-poc-lists-users',
     Defaults('training-poc-lists-users'),
     {
     Title: aPatch.Title,
     Description: aPatch.Description,
     Deadline: aPatch.Deadline,
     Duration:aPatch.Duration,
     'Training Status': aPatch.Status,
     Thumbnail: aPatch.Thumbnail,
     User: LabelUser.Text
     }
     ) 
    );

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • tamilkyway Profile Picture
    11 on at

    Hi @WarrenBelz , thank you so much for your help. I don't know if the Title should be the unique here because it should also exist in LIST B for other users. Example 
    Lists of trainings in LIST A:
    Training 01
    Training 02
    Training 03

    Now once a user will click the button.
    It should patch it to List B: Example view in List B
    Title               User
    Training 01    User1
    Training 02    User1
    Training 03    User1
    Training 01    User2
    Training 02    User2
    Training 03    User2

  • WarrenBelz Profile Picture
    156,756 Most Valuable Professional on at

    @tamilkyway ,

    Does what I provided work for you ?

  • tamilkyway Profile Picture
    11 on at

    Hello again @WarrenBelz , I really appreciate your reply.
    For the code you provided, the only Trainings that will display on my screen is the one that I freshly patched into List B. Other users cannot patched the trainings that I already patched with because it already existing in LIST B under my name.

    Here is what I was hoping to do in my APP. I hope I was able to make it understandable.

    training.png

     

  • WarrenBelz Profile Picture
    156,756 Most Valuable Professional on at

    Hi @tamilkyway ,

    As you can understand, I cannot see your data and have to assume (guess) things based on what you have posted. The code I supplied will filter out anything in the collection which already has the same Title field as the list, then add everything left as new records in the list - which is why I asked which field determines whether a matching record exists.

  • tamilkyway Profile Picture
    11 on at

    Hello @WarrenBelz , here are the lists containing sample data: 
    'training-poc-lists' : contains all the trainings that all users should be getting under their name on column "User" on the 'training-poc-lists-users'
    training.png

    As you can see on the "training-poc-lists-users", not all trainings are on each 'Users' name

  • WarrenBelz Profile Picture
    156,756 Most Valuable Professional on at

    Hi @tamilkyway ,

    I am actually more unclear now - can I ask a basic question here  - what determines whether something is a "new" training and not a duplicate (what field/s are the same in both lists in a duplicate).

  • tamilkyway Profile Picture
    11 on at

    I apologize for making it more unclear. Your code works which really answers the question thread and what came after is just additional question which should have been another topic. 😄 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard