cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

BrowseGallery Search/Filter always navigates to first item first

Hi,

 

I have a weird issue that I'm hoping to get some assistance with. I have a gallery with a Filter function that works just as I want it to and is displaying the correct items. With just the filter options, if I select an item, it navigates to that item every time. However, if I add a search in the function, the items still display properly but they always navigate to the first item displayed the first time. Then when I go back and navigate to the item, it works that time. I've tried a number of different formulas and they all do the same thing. Here are the formulas I have been working with. Any assistance is appreciated.

 

Works correctly (no search option):

 

SortByColumns(Filter('Activation Requests', If(!IsBlank(PRSEmailVar),PRS_x0020_Email = PRSEmailVar,true) && If(!IsBlank(StatusVar),Setup_x0020_Status.Value = StatusVar,true) && If(!IsBlank(SuperVar),PRS_x0020_Supervisor.Email = User().Email,true)),SortVar, AscDesVar)

 

Works incorrectly (includes search option):

 

Version 1:

 

If(IsBlank(TextSearchBox1),SortByColumns(Filter('Activation Requests', If(!IsBlank(PRSEmailVar),PRS_x0020_Email = PRSEmailVar,true) && If(!IsBlank(StatusVar),Setup_x0020_Status.Value = StatusVar,true) && If(!IsBlank(SuperVar),PRS_x0020_Supervisor.Email = User().Email,true)),SortVar, AscDesVar),SortByColumns(Search('Activation Requests',TextSearchBox1.Text,"Client_x0020_Name_x0028_s_x0029_","Client_x0020_Number_x0028_s_x002"),SortVar, AscDesVar))

 

Version 2:

 

SortByColumns(Filter('Activation Requests', If(!IsBlank(PRSEmailVar) && IsBlank(TextSearchBox1),PRS_x0020_Email = PRSEmailVar,true) && If(!IsBlank(StatusVar) && IsBlank(TextSearchBox1),Setup_x0020_Status.Value = StatusVar,true) && If(!IsBlank(SuperVar) && IsBlank(TextSearchBox1),PRS_x0020_Supervisor.Email = User().Email,true) && If(!IsBlank(TextSearchBox1),TextSearchBox1.Text in Client_x0020_Number_x0028_s_x002 Or TextSearchBox1.Text in Client_x0020_Name_x0028_s_x0029_,true)),SortVar, AscDesVar)

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

2 REPLIES 2
v-monli-msft
Community Support
Community Support

Hi @Anonymous,

 

I just looked into your formula, I think the Search function part is correct as long as the column names are correct. But I have question about SortByColumns part. 

 

There are 2 kinds of Syntax for SortByColumns function, which one are you using? And what is SortVar and AscDesVar stand for?

SortByColumns( Table, ColumnName1 [, SortOrder1, ColumnName2, SortOrder2, ... ] )
SortByColumns( Table, ColumnName, SortOrderTable )

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,606)