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

Filter in a browse screen

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Filter in a browse screen

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.

 

View solution in original post

13 REPLIES 13
Highlighted
Community Champion
Community Champion

Re: Filter in a browse screen

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.

Highlighted
Helper I
Helper I

Re: Filter in a browse screen

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

Highlighted
Community Champion
Community Champion

Re: Filter in a browse screen

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.

 

View solution in original post

Highlighted
Helper I
Helper I

Re: Filter in a browse screen

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

Highlighted
Helper I
Helper I

Re: Filter in a browse screen

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

Highlighted
Community Champion
Community Champion

Re: Filter in a browse screen

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.

Highlighted
Helper I
Helper I

Re: Filter in a browse screen

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.

Highlighted
Community Champion
Community Champion

Re: Filter in a browse screen

Hi@AndrewJRoberts ,

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

 

Highlighted
Helper I
Helper I

Re: Filter in a browse screen

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)))

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,532)