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 / Filter in a browse screen
Power Apps
Answered

Filter in a browse screen

(0) ShareShare
ReportReport
Posted on by 49

Hi

 

I have been following Shane Young's instructions on how to use Multiple Drop Downs to filter (but using a combobox) data and I have hit a block; again. 

 

In a SharePoint list I have two field, both Text Fields "Customer" and "Order Number"

The first stage was to create and test a search using the "Order Number", before moving on to adding a second 

 

  • "Browse Screen 1"
    • OnVisible
      • ClearCollect(Collect3, {Result: "All"}); Collect(Collect3, Distinct(Sales, 'Order Number'))
  • BrowseGallery1
    • Combo Box cmbOrderSearch
      • Collect3
  • Items
    • Filter(Sales, 'Order Number'=cmbOrderSearch.Selected.Result)

When I try to add the "If" statement things stops working for the True (Sales, 'Order Number')

If(cmbOrderSearch.Selected.Result = “All”, Sales, 'Order Number', Filter(Sales, 'Order Number'=cmbOrderSearch.Selected.Result)

Any help would be appreciated 

 

Many Thanks in advance.

BR 

 

Andy

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,425 Most Valuable Professional on at

    Hi @AndrewJRoberts ,

     

    Firstly, parsing your code below, you have a bracket missing at the end to close, bit more importantly have an extra argument in your If statement.

    If(
     cmbOrderSearch.Selected.Result = “All”
    , 
     Sales
    , 
     'Order Number'
    , 
     Filter(
     Sales, 
     'Order Number'=cmbOrderSearch.Selected.Result
     )

    Please let me know if I need to look further.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • AndrewJRoberts Profile Picture
    49 on at

    Yes the issue is around the section , Sales, 'Order Number',

    Sales is the name of the Sharpoint Table, Order number is the column

     

    If I take out the section 'Order Number' it brings up all details of all the Table records, if I take out Sales, it creates an error

     

    Andy

  • Verified answer
    WarrenBelz Profile Picture
    156,425 Most Valuable Professional on at

    Hi @AndrewJRoberts ,

    OK - if "All" is selected, you want all sales results, but if something else is selected, you want only the results matching the selection. So the Items property of your gallery should be 

    If(
     cmbOrderSearch.Selected.Result = “All”, 
     Sales,
     Filter(
     Sales, 
     'Order Number'=cmbOrderSearch.Selected.Result
     )
    )

    You are saying you are getting all the records - what is the value of cmbOrderSearch.Selected.Result when this is happening? Put a label on the screen and set the Text property to this to check.

     

  • AndrewJRoberts Profile Picture
    49 on at

    Your latest information worked a treat, Thank you so much.

  • AndrewJRoberts Profile Picture
    49 on at

    I have been off site since my last response and now I am back a request has come in to modify the search filter.
    They now need a second search filter to allow them to search either by the Customers name or Order number.
    I have started to amend the app so the relating details

     

    • Browse Screen 1
      • OnVisible
        • ClClearCollect(Collect3, {Result: "All"}); Collect(Collect3, Distinct(Sales, 'Order Number')); ClearCollect(Collect2, {Result: "All"}); Collect(Collect2, Distinct(Sales, Customer.Value))
    • BrowseGallery1
      • Combo Box cmbOrderSearch
        • Items Collect3
      •  Combo Box cmbCustomerSearch
        • Items Collect2
    •  BrowseGallery1
      • Items If(cmbOrderSearch.Selected.Result = "All", Sales, Filter( Sales,'Order Number'=cmbOrderSearch.Selected.Result))

    I attempted to amend the equation in "BrowseGallery1 Items" to accommodate the second search but to no avail. Ideally when they filter on a "cmbCustomerSearch",  the result will limit the orders numbers in the  "cmbOrderSearch".

     

    I do hope I have explained my self good enough

     

    Thankyou in advance

     

    Andy

  • WarrenBelz Profile Picture
    156,425 Most Valuable Professional on at

    Hi @AndrewJRoberts ,

    There may be a more elegant way, but the below structure should work - you may have to clean up commas/brackets as I cannot test it. I have allowed for customer number to be blank.

    If(
     cmbOrderSearch.Selected.Result = "All", 
     If(
     !isBlank(cmbCustomerSearch),
     Filter(
     Sales,
     cmbCustomerSearch = cmbCustomerSearch.Selected.Result
     ),
     Sales
     ), 
     If(
     !isBlank(cmbCustomerSearch),
     Filter(
     Sales,
     cmbCustomerSearch = cmbCustomerSearch.Selected.Result &&
     'Order Number'=cmbOrderSearch.Selected.Result
     ),
     Filter(
     Sales,
     'Order Number'=cmbOrderSearch.Selected.Result
     )
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • AndrewJRoberts Profile Picture
    49 on at

    First of all thank you

     

    the only issue is around  the two occurances of "=" in the equation cmbCustomerSearch = cmbCustomerSearch.Selected.Result.  it is under lined in red and the error message reported in the app checker says Invalid Arguement.

  • WarrenBelz Profile Picture
    156,425 Most Valuable Professional on at

    Hi@AndrewJRoberts ,

    You need to rename your combo box - never  name it the same as the field it contains

     

  • AndrewJRoberts Profile Picture
    49 on at

    Sorry Warren

     

    I have managed to make a right pigs ear of things and now I have totally confused myself. The issue is still the '=' in the BrowseGallery1 Item equation.

     

    • Browse Screen 1
      • OnVisible
        • ClearCollect(Collect3, {Result: "All"}); Collect(Collect3, Distinct(Sales, 'Order Number')); ClearCollect(Collect2, {Result: "All"}); Collect(Collect2, Distinct(Sales, Customer.Value))
    • BrowseGallery1
      • Combo Box cmbOrderSearch
        • Items Collect3
      • Combo Box cmbCustomerlookup
        • Items Collect2
    • BrowseGallery1
      • Items 
        • If(cmbOrderSearch.Selected.Result = "All",If(!IsBlank(cmbCustomerlookup), Filter(Sales,'Customer' = cmbCustomerlookup.Selected.Result), Sales), If(!IsBlank(cmbCustomerlookup),Filter(Sales,'Customer' = cmbCustomerlookup.Selected.Result &&'Order Number'=cmbOrderSearch.Selected.Result),Filter(Sales,'Order Number'=cmbOrderSearch.Selected.Result)))
  • WarrenBelz Profile Picture
    156,425 Most Valuable Professional on at

    OK @AndrewJRoberts ,

    Timezone will see me offline shortly. I will have a good look at this and get back to you as soon as I can.

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard