cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Filter in a Gallery

Hi,

I have 2 tables: the first one is "Employees" and the second one is "Hobbies":
 employeetable.JPG
 
hobbiestable.JPG
In PowerApps I have a Gallery (Gallery1) with the Employees that can be selected:
 gall1.JPG
 
I created a second Gallery where I want to see all the hobbies for the selected Employee:
gall2.JPG
On Items, I put the following formula, but it has an incompatibility error:
 
Filter('[dbo].[Hobbies]',EmployeeID=Gallery1.Selected.EmployeeID)
 
incompatible.JPG
 
How can I change the Filter Formula in order to avoid this error?
 
Thank you!
 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Filter in a Gallery

Hi @lstan 

Can you confirm the data types of the EmployeeID columns in your tables? For example, if Employees.EmployeeID is type int and Hobbies.EmployeeID is type nvarchar, this could result in this error.

To resolve this type of problem, you can call the Value function to convert text values to numbers.

Filter('[dbo].[Hobbies]',
         Value(EmployeeID)=Value(Gallery1.Selected.EmployeeID) 
)

View solution in original post

2 REPLIES 2
Highlighted
Super User
Super User

Re: Filter in a Gallery

Hi @lstan 

Can you confirm the data types of the EmployeeID columns in your tables? For example, if Employees.EmployeeID is type int and Hobbies.EmployeeID is type nvarchar, this could result in this error.

To resolve this type of problem, you can call the Value function to convert text values to numbers.

Filter('[dbo].[Hobbies]',
         Value(EmployeeID)=Value(Gallery1.Selected.EmployeeID) 
)

View solution in original post

Highlighted
Frequent Visitor

Re: Filter in a Gallery

Hi @timl,

 

It worked using Value() function.

 

Thank you Smiley Happy

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (6,370)