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 Apps
Answered

Gallery Filtering

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Greetings.

I have a requirement to filter my gallery in multiple scenarios. Please find the below requirement.

  1. Filter Gallery by TextInput Text
  2. Filter Gallery by From and To Dates
  3. Filter Gallery by the current user (only when a button is clicked)
  4. Filter Gallery by Status ( Approved, Rejected, Pending)[ Only when Approved or Rejected or Pending button is clicked]

Currently, I have completed the first and second requirements. I would be needing help with the remaining requirements.
I am looking to extend the below code to meet all the requirements.

Sort(
 Filter(
 MCRRequest,
 Or(
 (TextInput1_1.Text in Title),
 (TextInput1_1.Text in 'Unique Code'),
 (TextInput1_1.Text in 'Part Number'),
 (TextInput1_1.Text in 'Created By'.DisplayName))
 &&
 If(Value(DatePicker1_2.SelectedDate)=0,true,
 Created >= DatePicker1_2.SelectedDate && Created <= DatePicker1_3.SelectedDate)),
 Created,
 Descending
)
Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,925 on at

    I believe you are using a SharePoint, try

    3. Insert a Button and OnSelect put:
    Set(VarUser,User().FullName)

     

    4. Insert a Combobox1 and on its items put:
    Choices(Datasource,Status)

     

    Then change the filter to;

    Sort( Filter( MCRRequest, Or( (TextInput1_1.Text in Title), (TextInput1_1.Text in 'Unique Code'), (TextInput1_1.Text in 'Part Number'), (TextInput1_1.Text in 'Created By'.DisplayName)) &&
    UserColumn=VarUser&&
    Status.Value=
    Combobox1.Selected.Value&& If(Value(DatePicker1_2.SelectedDate)=0,true, Created >= DatePicker1_2.SelectedDate && Created <= DatePicker1_3.SelectedDate)), Created, Descending )

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

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @eka24 I have applied your formula but then there is one problem with it. 
    As I land on the screen my gallery does not show any data as the formula clearly states that should check for var user and also combobox1 value. 
    I would want the gallery to show all data when you come on that screen, but when the user wants to filter he can out of anything given to him. Be it Date filtering, text filtering, status filtering, and also My record filtering. 
    The formula puts a break on that part.
    I have a reset button that resets all the values of the date picker, text input. so I think I need to reset var user and also Combobox too?

    How can I solve the above issue and also allow the user to filter and also reset the filters to show all the gallery data?

  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    You can apply the if logic to check the varuser and combobox.selected.value exist as follows.

    Sort(
    Filter( MCRRequest,
    Or( (TextInput1_1.Text in Title),
     (TextInput1_1.Text in 'Unique Code'),
     (TextInput1_1.Text in 'Part Number'),
     (TextInput1_1.Text in 'Created By'.DisplayName)
    ) &&
    If(IsBlank(VarUser),true, UserColumn=VarUser)&&
    If(IsBlank(Combobox1.Selected.Value), true ,Status.Value=Combobox1.Selected.Value)&&
    If(Value(DatePicker1_2.SelectedDate)=0,true, Created >= DatePicker1_2.SelectedDate && Created <= DatePicker1_3.SelectedDate)),
    Created, Descending )

    And set OnSelect property of Reset button as follows.

    Set(VarUser,Blank());Reset(ComboBox1)

    Hope this helps.
    Sik

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

#2
11manish Profile Picture

11manish 193

#3
Valantis Profile Picture

Valantis 138

Last 30 days Overall leaderboard