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 / Unable to add an If st...
Power Apps
Unanswered

Unable to add an If statement to Gallery sorting/filtering

(0) ShareShare
ReportReport
Posted on by

I am trying to show all items in my gallery if nothing is selected on combobox and/or nothing has been typed on text input box. I've tried a bunch of different combinations of placement and it doesnt seem to work with the search and filter nestled in the formula - it only works with either or. 

 

here is my formula --- 

 

Filter(Search(SortByColumns('Altamonte Skills', "Group", SortOrder.Descending, "SkillNumber_x003a_", SortOrder.Ascending), numbersearchbox.Text, "SkillName_x003a_", "SkillNumber_x003a_", "Group"), 'Group' in skillsgroupDrop.SelectedItems.Value)

Categories:
  • Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    Hi @AMR1009 ,

     

    The below may not be what you need, but it should give you some direction on the correct pattern.

     

     

    SortByColumns(
     Search(
     Filter(
     AddColumns(
     'Altamonte Skills',
     "_group",
     Group.Value
     ),
     CountRows(skillsgroupDrop.SelectedItems) = 0 || Group.Value in skillsgroupDrop.SelectedItems.Value
     ),
     numbersearchbox.Text,
     "SkillName_x003a_",
     "SkillNumber_x003a_",
     "_group"
     ),
     "_group",
     SortOrder.Descending
    )

     

     

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

    Imran-Ami Khan

  • Anonymous_Hippo Profile Picture
    1,247 Super User 2024 Season 1 on at

    Hello @AMR1009 

    Can you try this

    Filter(
     SortByColumns(
     'Altamonte Skills',
     "Group", SortOrder.Descending,
     "SkillNumber_x003a_", SortOrder.Ascending
     ),
     (IsBlank(numbersearchbox.Text) || 'SkillName_x003a_' in numbersearchbox.Text || 'SkillNumber_x003a_' in numbersearchbox.Text || 'Group' in numbersearchbox.Text) &&
     (CountRows(skillsgroupDrop.SelectedItems) = 0 || 'Group' in skillsgroupDrop.SelectedItems.Value)
    )
    

     

    Cheers !

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 224 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 126

Last 30 days Overall leaderboard