cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tango
Helper IV
Helper IV

Filtering from a Combo Box when combo box is empty, assistance

Hi,

 

I have a filter that uses a combo box & am am using a method to get around delegation. All working fine but I want to address how to show all records if nothing selected in the combo box.

 

In other functions I would just add ||cbstatus.Selected.Result=Blank()) but not sure where to put it. Ive tried a few varioations but cant get it to work.

 

My filter is

 

Filter(Col3,
Or(
'mycolumn'.Value = First(cbstatus.SelectedItems).Value,
'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,2)).Value,
'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,3)).Value,
'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,4)).Value,
'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,5)).Value,
'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,6)).Value
)

)

 

Thanks in advance

 

Todd

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Tango ,

Something like this should do it

Filter(
   Col3,
   (
      Len(cbstatus.Selected.Value) = 0 ||
      (
         'mycolumn'.Value = First(cbstatus.SelectedItems).Value ||
         'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,2)).Value ||
         'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,3)).Value ||
         'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,4)).Value ||
         'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,5)).Value ||
         'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,6)).Value
      )
   )
)

 

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.

Visit my blog Practical Power Apps

View solution in original post

8 REPLIES 8
WarrenBelz
Super User
Super User

Hi @Tango ,

Something like this should do it

Filter(
   Col3,
   (
      Len(cbstatus.Selected.Value) = 0 ||
      (
         'mycolumn'.Value = First(cbstatus.SelectedItems).Value ||
         'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,2)).Value ||
         'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,3)).Value ||
         'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,4)).Value ||
         'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,5)).Value ||
         'mycolumn'.Value = Last(FirstN(cbstatus.SelectedItems,6)).Value
      )
   )
)

 

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.

Visit my blog Practical Power Apps

Thanks for your response @WarrenBelz , so is there no need to used Blank() ?

Hi @Tango ,

I use Len() as it covers both Blank() and empty string ""

 

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.

Visit my blog Practical Power Apps

@WarrenBelz thanks for the clarification

@Tango ,

So this is solved now ?

Thanks @WarrenBelz no error message but not returning any results which I know are there.

 

In addition, when i select an option form the dropdown all the records appear and not the actual filter

@Tango ,

Typo in my code - please see it now

@WarrenBelz thank you so much

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (4,168)