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 / Compare records of sha...
Power Apps
Answered

Compare records of sharepoint to items in a gallery

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi everyone,

 

I'm trying to check if in the column 'Departamento' in the sharepoint list 'Equipa' is there any records with the same Departamento as in the gallery items. If there is the variable will be set to true, if not it will remove the gallery's item. Can you guys help me? I have this code but it doesn't work.

 

/*ForAll(Equipa,
 If(Departamento = ThisItem.Departamento,
 Set(gblShowPP, true),
 Remove(Departamento, ThisItem)
)*/
Categories:
I have the same question (0)
  • madlad Profile Picture
    2,637 Moderator on at

    Hi!

     

    There's a couple things going on here, but to start - If this is being used in a control that's inside the gallery, something like the following code could work:

     

    If(
     ThisItem.Departamento in Equipa.Departmento,
     Set(gblShowPP, true),
     Remove(*GalleryDataSource*, ThisItem)
    )

     

    This uses in to check if ThisItem.Departmento is in Equipa.Departmento. Please note you'll have to swap in your galleries datasource into the remove function.

     

    Hope this helps!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi!

     

    With this code it gives me the following error: Can't convert this data type. Power apps can't convert this Text to a Record.

  • madlad Profile Picture
    2,637 Moderator on at

    Where is the error highlighted?

    It looks like we're trying to compare text to a record value somewhere, which is no good.

    As a side note, what's your datasource for this, and what's the column type of Equipa.Departmento?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    The error is highlighted in

    ThisItem.Departamento

    My datasource is a sharepoint list and Equipa.Departamento is a choice.

  • madlad Profile Picture
    2,637 Moderator on at

    I see. Perhaps we can throw in a forall to get the choice column values.

    Try replacing the "in" function with:

     

    ThisItem.Departamento in ForAll(Equipa.Departmento, Departmento.Value)

     

     Let me know how it goes!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    The ForAll function is all highlighted right now and it gives me this errors: The Function ForAll has some invalid arguments. and Departamento isn't recognized. 😅

  • Verified answer
    madlad Profile Picture
    2,637 Moderator on at

    That error indicates that the column "Departamento" isn't in the table returned by Equipa.Departamento. 

     

    Two things I see:

    I realized, we actually can just use "Equipa" in the forall.

    Also just realized I've been spelling "Departamento" wrong this whole time lol 

     

    Try the following code as a forall, and if it still doesn't work, double check the column names are correct - those should solve it hopefully.

    ForAll(Equipa, Departamento.Value)

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    You are a legend!! Thank you so much!!

    I was also spelling Departamento wrong!

    Thank you so much!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard