cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Newbie2019
Level 8

Two Galleries - Second gallery won't sort by columns filter starts with ....

Hi,

I was wondering if anyone had any suggestions as to why the my sort by columns does not work.

 

Within my app I have two galleries.

 

The first search which works has:

 

SortByColumns(Filter(MIMS, StartsWith(Student(, TextSearchBox1.Text)), "Student", If(SortDescending1, Descending, Ascending))

 

This works. I can enter the first part of a name and it populates all entries under that name.

 

I have made a duplicate of this gallery and the only difference is that I have added a toggle to this page.

 

The search field has the following:

 

SortByColumns(Filter(MIMS, StartsWith(Student(, TextSearchBox1_2.Text)), "Student", If(SortDescending1, Descending, Ascending))

 

Even though I have changed the textsearchbox, it will not perform a search.

 

I would also like to know how to reverse the list so it auto polulates based on date newest to oldest

 

Any suggestions would be appreciated.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Two Galleries - Second gallery won't sort by columns filter starts with ....

Hello!

 

Ok, I see what the problem is - that code needs to go into the Items of the gallery, the textbox requires no code at all as the gallery is doing the filtering by the contents of the textbox!

 

Could you try that for me with the code I suggested and let me know how that goes?

 

Thanks,

Sancho




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

5 REPLIES 5
Super User
Super User

Re: Two Galleries - Second gallery won't sort by columns filter starts with ....

Hiya!

 

It looks like there's an additional open bracket in this formula, could you try removing it?

 

 

SortByColumns(
    Filter(
        MIMS,
        StartsWith(
            Student(, TextSearchBox1_2.Text)
        ),
        "Student", If(SortDescending1, Descending, Ascending)
    )

If you want to sort these by Created Date then use a DateColumn such as Created (if that's the name available in your datasource):

 

 

SortByColumns(
    Filter(
        MIMS,
        StartsWith(
            Student,
TextSearchBox1_2.Text
) ), "Created",
If(SortDescending1, Descending, Ascending) )

Can you confirm that the Second Searchbox is TextSearchBox1_2 as well?

 

Thanks,

Sancho




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
Newbie2019
Level 8

Re: Two Galleries - Second gallery won't sort by columns filter starts with ....

Hi @iAm_ManCat 

Thank you for your assistance. I seem to still have the same problem. 

 

The first gallery has throws an error when the suggested bracket is removed:

 

brac.JPG

 

When I hover on the red x is states: Expected Text Value

 

If I restore the original formula it works.

 

brac 3.JPG

When I use the same code on the net gallery, but changing for a different text box:

 

brac 2.JPG

 

When I type a first name search, nothing happens....

 

Is it perhaps not possible to have two galleries searching the same sharepoint list?

 

I will try the suggested 'created' feature shortly.

 

Any further suggestions @iAm_ManCat would be appreciated.

 

Cheers.

 

Super User
Super User

Re: Two Galleries - Second gallery won't sort by columns filter starts with ....

Hello!

 

Ok, I see what the problem is - that code needs to go into the Items of the gallery, the textbox requires no code at all as the gallery is doing the filtering by the contents of the textbox!

 

Could you try that for me with the code I suggested and let me know how that goes?

 

Thanks,

Sancho




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

Newbie2019
Level 8

Re: Two Galleries - Second gallery won't sort by columns filter starts with ....

Hi @iAm_ManCat 

 

Thank you so much for identifying the problem. I'm an idiot!

 

I have changed the formula to 'created'. I was wondering how I reverse the gallery so the newest entires populate first?

 

Newest  to Oldest based on the 'created' field?

 

Thanks again for your assistance.

Super User
Super User

Re: Two Galleries - Second gallery won't sort by columns filter starts with ....

Hi @Newbie2019

 

Happy to help - what you've got in your formula is a default way of sorting, which is defined by a variable (that variable is then changed by pressing the sort button within the menu bar)

 

So in your formula,

If(SortDescending1, Descending, Ascending)

Change them around to:

If(SortDescending1, Ascending, Descending)

 

This should reverse the sort order by default, and allow others to still change the direction using the sort button,

 

I hope all of this has helped you, please feel free to Thumbs Up any posts that you feel have contributed 🙂

 

Cheers,

Sancho




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,435)