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 / Component Data Source
Power Apps
Answered

Component Data Source

(0) ShareShare
ReportReport
Posted on by 1,146

Thank you for taking the time to read my question.

 

I'm not 100% clear on how components work. I want to make a navigation bar in my app using a horizontal gallery.

 

The Items = 

 

Filter(FacilityLines,Title = SelectedFacility.Text,Line <> SelectedLine.Text)

FacilityLines is a SharePoint list

SelectedFacility is Set() as a variable

SelectedLine is Set() as a variable

 

If I put the above in as the items of the horizontal gallery in my new component, the SelectedFacility.Text and SelectedLine.Text are red underlined. So I made two Custom Properties:

 

inptFacility

inptLine

 

I then put that into my Items but they are now red underlined.

 

Filter(FacilityLines,Title = inptFacility,Line <> inptLine)

 

I made

inptFacility = SelectedFacility.Text

inptLine = SelectedLine.Text

 

I inserted the component onto my screen in hopes that it would just work as the variables are available there and work correctly (I added two labels and made them equal to the variables and they show the correct text) but it does not.

 

How do I get the items to work for my component?

 

Thanks

 

Categories:
  • TheRobRush Profile Picture
    11,128 Moderator on at

    I created a button that set two variables

     

     

    Set(SelectedFacility,"A,Man");
    
    Set(SelectedLine,"Hernandez,Joseph")

     

     

    Then filtered a horizontal gallery by putting the following in the items

     

     

    Filter(LDROSTER,Title<>SelectedFacility,Title<>SelectedLine)

     

     

    Horizontal gallery returned and displayed all record that did not match those two variables as expected. maybe check your variable setting process and then gallery code against what I have here just to see if you can find what went wrong.

     

    **This will possibly give delegation errors/warnings, but if your datasource is small enough you can disregard those.

  • iwonder Profile Picture
    1,146 on at

    Thank you for the reply @TheRobRush 

     

    Did you do this inside a Component? I can get the horizonal gallery to work if I add it to a screen, just not if I make it a component which I then want to add to multiple screens.

     

    Thanks!

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Apologies, totally missed that this was in component.

     

    It is a known limitation, unfortunately, that data sources are not recognized within controls. 

     

    You can upvote the idea to allow that here

    Allow access to data source from within components 

  • iwonder Profile Picture
    1,146 on at

    No worries 🙂

     

    I can set the Items property of the horizontal gallery to the SharePoint list and that works, but when I try to Filter() that table, I'm not able to pass through the SelectedFacility value or the SelectedText value

     

     

  • Verified answer
    iwonder Profile Picture
    1,146 on at

    I just figured it out!!!

     

    I was not referring to the Custom Properties properly.

     

    Items of the horizontal gallery in the Component should be:

    Filter(FacilityLines,Title = Parent.inptFacility,Line <> Parent.inptLine)

     

    When I do this, I see the values I want in the Component when I add it to my screens

     

    Thanks

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Keeping the code the same, but collecting the source data first

     

    Collect(TestRoster,LDROSTER)

     

    I was then able to filter the horizontal gallery within the component based off my two global variables. If that helps you.

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Good deal, glad you found your error.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard