cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

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
Highlighted

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


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

5 REPLIES 5
Highlighted
Super User II
Super User II

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


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Highlighted

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.

 

Highlighted

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


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

Highlighted

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.

Highlighted

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


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (13,357)