cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tguihur
Helper I
Helper I

Filtering a gallery with a global variable

Hi everyone,

 

I have a gallery which shows the name and the school number. I also have a global variable with the number of the school where the user works.  So I would like to show only the rows where those  school numbers match.

 

I thought use a Filter function in the property ITEMS of the gallery, however it does not work.

 

Filter(Declarations; variableCompanyNumber=Gallery2.Subtitle2)

 

Declarations is the name of  my the Sharepoint list data source.

 

What should I do? Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @tguihur ,

Could you tell me:
1)how do you set this variable variableCompanyNumber?
2)the data type of SchoolNumber column?

3)what does "Gallery2.Subtitle2" represent?

I assume that :

gallery2 is this gallery's name, Subtitle2 is the control that you use to display SchoolNumber column.

So do you want to filter list that SchoolNumber column=variablevalue and display in gallery2?

If so, you need to make sure the data type of SchoolNumber column and the variable is the same.

Please try this:

Filter(Declarations;Value(SchoolNumber column)=Value(variableCompanyNumber))

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
eka24
Super User
Super User

Consider this formula on the Items property of the Gallery;

Filter(Declarations,SchoolNumber column=variableCompanyNumber)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

I tried it but it says :

 

Invalid argument type

 

GalleryPowerApps.PNG

Please show the formula for the variable in a screenshot

Also indicate the error message

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi @tguihur ,

Could you tell me:
1)how do you set this variable variableCompanyNumber?
2)the data type of SchoolNumber column?

3)what does "Gallery2.Subtitle2" represent?

I assume that :

gallery2 is this gallery's name, Subtitle2 is the control that you use to display SchoolNumber column.

So do you want to filter list that SchoolNumber column=variablevalue and display in gallery2?

If so, you need to make sure the data type of SchoolNumber column and the variable is the same.

Please try this:

Filter(Declarations;Value(SchoolNumber column)=Value(variableCompanyNumber))

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,131)