cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
A-HJ
Frequent Visitor

Filter Gallery and Search Function

I have a gallery which has a search box attached to it, I have tried the follow two formula in the Items of the gallery:

Search(
    Filter('Incident Report', Lower('Notified Users'.Email) = Lower(User().Email)),
    TextInputSearchBox.Text,
    "Title")

or

Filter(
    Search('Incident Report', TextInputSearchBox.Text, "Title"),
    Lower('Notified Users'.Email) = Lower(User().Email))

Both of which keep through the following formula error message:

Incompatible types for comparison.

These types cant be compared in the formula: Table, Text.

 

We cant evaluate your formula because the values being compared in the formula aren't the same type.

Location: GalIncReport.Items

 

Both filter formula and search formula (below) both work when used independently of each other but not when combined to the above.

Filter('Incident Report', Lower('Notified Users'.Email) = Lower(User().Email)

Search('Incident Report', TextInputSearchBox.Text, "Title")

 

The OnSelect property of the gallery has the following variable

Set(
VarTab,
"Incident Details"
) && Set(
VarRecord,
ThisItem
)

 

For info gallery data is pulling from a SharePoint list.  'Notified Users' Column of the SharePoint list is a People and Group type

 

Any assistance would be very much appreciated

2 REPLIES 2
RandyHayes
Super User
Super User

@A-HJ 

You are best to filter and then search as search is not a delegable function.

Your formula should be the following:

Search(
    Filter('Incident Report', 
        StartsWith('Notified Users'.Email, User().Email)
    ),
    TextInputSearchBox.Text,
    "Title"
)

If that still gives you and error, please look at your Notified Users column definition - is it set up to allow multiple selections?

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
A-HJ
Frequent Visitor

Thanks for your help with this.  Have checked the notified users column in SharePoint and this is set to allow multiple users.

 

I am now getting the two following errors:

Invalid argument types (Table). Expecting a Text value instead

and

This function 'StartsWith' has some invalid arguments

 

In short I need the gallery not show items to the if the logged in user does not appear in the Notified Users column of the SharePoint list.  I than need the search box to be functional which search the Title field of SharePoint list.  The notified users column is not displayed in the gallery though.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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