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 / Checking names on two ...
Power Apps
Answered

Checking names on two collections updating table

(0) ShareShare
ReportReport
Posted on by 20

I have two collections that I would like to cross reference names on

Collection 1

Name
Bob
Tom

Collection 2

Task NumberName
1Bob
2Bob
1Harry
2Harry

Table

TaskNameOther
.........

So in my case I would like to see if Collection 2 has a matching Name in Collection 1, if it does than not to update the table with that Name and Tasks, if it does not have a matching name than to update the table with the Name and Tasks.

So if I were to check Collection 2 against Collection 1 in this example the table would yield

Table

TaskNameOther
1Harry...
2Harry...

I would put in the code I wrote but no part of it works so it would just be a waste of time. I would appreciate any help. Thanks. 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi nekinekic,

    you can use search function to check that name is available on collection 1 or not.

     Search(Table*, SearchStringColumn1 [, Column2, ... ] )  Example Search(Collection2,"Rahul","Name") 

    then use patch or update function to add new record on Collection2.

     

    Thanks,

    Chitrakant27

     

  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @nekinekic ,

     

    I did a test for you.

     

    1\ This is my collection1.

    ClearCollect(Collection1,{Name:"Bob"},{Name:"Tom"})

    v-xiaochen-msft_0-1619589521775.png

     

    2\ This is my collection2.

    ClearCollect(Collection2,{TaskNumber:1,Name:"Bob"},{TaskNumber:2,Name:"Bob"},{TaskNumber:1,Name:"Harry"},{TaskNumber:2,Name:"Harry"})

    v-xiaochen-msft_1-1619589557936.png

     

    3\ This is my Table

    ClearCollect(Table,{Task:6,Name:"Test",OtherColumn1:"Test"})

    v-xiaochen-msft_2-1619589702917.png

     

    4\ Add a button control and set its onselect property to:

    ForAll(Collection2 As A,If(CountRows(Filter(Collection1,Collection1[@Name]=A.Name))=0,Patch(Table,Defaults(Table),{Task:A.TaskNumber,Name:A.Name})))

     

    5\ The result is as follows:

    v-xiaochen-msft_3-1619590006595.png

     

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 477

#2
WarrenBelz Profile Picture

WarrenBelz 341 Most Valuable Professional

#3
11manish Profile Picture

11manish 317

Last 30 days Overall leaderboard