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

Notifications

Announcements

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,142

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:
I have the same question (0)
  • 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,142 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,142 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,142 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard