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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

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