cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
iwonder
Impactful Individual
Impactful Individual

Component Data Source

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
iwonder
Impactful Individual
Impactful Individual

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

View solution in original post

7 REPLIES 7
TheRobRush
Super User
Super User

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.

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!
iwonder
Impactful Individual
Impactful Individual

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
Super User
Super User

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 

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!
iwonder
Impactful Individual
Impactful Individual

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

 

 

iwonder
Impactful Individual
Impactful Individual

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

View solution in original post

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.

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!
TheRobRush
Super User
Super User

Good deal, glad you found your error.

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,177)