web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Adding search and sort...
Power Apps
Answered

Adding search and sort function into my gallery

(0) ShareShare
ReportReport
Posted on by 31

Hi Guys,

 

Any help of advice would be greatly appreciated.

 

Within the items function for my gallery I'm currently using the below formula

 

Switch(

    varTabSelected,

    1,

    'Signal Prep Sheet',

    2,

    Filter(

        'Signal Prep Sheet',

        'Is another prep shift required?'.Value = "Yes"

    ),

    3,

    Filter(

        'Signal Prep Sheet',

        'Is another prep shift required?'.Value = "No - Fully Prepped"

    )

   

)

 

I would like to create the ability for users to sort and also search within the same gallery by using the below

 

SortByColumns(Filter([@'Signal Prep Sheet'],StartsWith('Signal ID',TextInputSearch_1.Text)),"Title",If(varSortOrder,Descending,Ascending))

 

My question is can I combine these functions without breaking my app or do I need to create a separate gallery to be be able to sort ascending/descending?

If it's possible to combine these functions how would I go about writing this?

 

Thanks 

 

Categories:
I have the same question (0)
  • C-Papa Profile Picture
    1,836 on at

    Hi, you should be able to combine it, does this work?

     

    SortByColumns(

    Switch(

        varTabSelected,

        1,

        'Signal Prep Sheet',

        2,

        Filter(

            'Signal Prep Sheet',

            'Is another prep shift required?'.Value = "Yes"

        ),

        3,

        Filter(

            'Signal Prep Sheet',

            'Is another prep shift required?'.Value = "No - Fully Prepped"

        )

    )

    ,"Title",If(varSortOrder,Descending,Ascending))

  • Verified answer
    Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    Switch(

        varTabSelected,

        1,

        SortByColumns(Filter([@'Signal Prep Sheet'],StartsWith('Signal ID', TextInputSearch_1.Text)),"Title",If(varSortOrder,Descending,Ascending)),

        2,

    SortByColumns(Filter([@'Signal Prep Sheet'],StartsWith('Signal ID',TextInputSearch_1.Text), 'Is another prep shift required?'.Value = "Yes"),"Title",If(varSortOrder,Descending,Ascending)),

        3,

    SortByColumns(Filter([@'Signal Prep Sheet'],StartsWith('Signal ID',TextInputSearch_1.Text), 'Is another prep shift required?'.Value = "No - Fully Prepped"),"Title",If(varSortOrder,Descending,Ascending))

    )

     

    Try something like that

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,

    Gonçalo Nogueira

    Check my LinkedIn!

    Buy me a coffee!

    Check my User Group (pt-PT)!

    Last Post on Community

    My website!

  • zmorek Profile Picture
    3,272 on at

    Might be able to tighten up the formula a bit too:

     

    With({wDataSource:
    	SortByColumns(
    			Filter(
    				['@Signal Prep Sheet'],
    					StartsWith(
    						'Signal ID', TextInputSearch_1.Text
    						)
    					), "Title",If(
    						varSortOrder, Descending,Ascending
    						)
    					)
    				},
    	Swich(varTabSelected,
    	1,
    		wDataSource,
    	2,
    		Filter(wDataSource,'Is another prep shift required?'.Value = "Yes"),
    	3,
    		Filter(wDataSource, 'Is another prep shift required?'.Value = "No - Fully Prepped")
    		)
    	)

     

  • iknownothing Profile Picture
    31 on at

    Thanks this worked perfect for what I'm currently doing, I really appreciate it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard