cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Community Support
Community Support

Re: How to apply filter based two conditions on listbox

Hi @kmk ,

Sure, please set the OnSelect property of the Filter button to following:

If(
   !IsBlank(txtfrom.Text) && !IsBlank(txtto.Text),
   UpdateContext({FromToFilter: true}),
   UpdateContext({FromToFilter: false})
)

Please set the Items property of the ListBox3 to following:

Distinct(
    Filter(
       Table,
       If(
          IsBlank(ListBox1.Selected.Result),
          true,
          Type in ListBox1.SelectedItems.Result
       ),
       If(
          IsBlank(ListBox2.Selected.Result),
          true,
          Location in ListBox2.SelectedItems.Result
       ),
       If(
          FromToFilter = true,
          Weight > Value(txtfrom.Text) && Weight < Value(txtto.Text),
          true
       )
    ),
    Source
)

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
kmk Helper IV
Helper IV

Re: How to apply filter based two conditions on listbox

Hi @v-xida-msft ,

 

Just sharing the update,

1.With out selecting listbox 2, list box 3 items are loaded. list box 3 has to load when only select the list box 2 items.

2. first time when i enter from-to and press button its loading Fine, but the movement when i try to change the values from to then its list box 3 items loading automatically with out button pressing. It has to load every time when only click the button.

 

Community Support
Community Support

Re: How to apply filter based two conditions on listbox

Hi @kmk ,

Based on the needs that you posted here, I think they are different from your original needs.

 

Please consider open a new thread to share your updated needs there, then we could help you solve your problem there. For current scenario, I think the solution I provided above could achieve your need.

 

If the solution I provided above could achieve your original issue, please consider click "Accept as Solution" to identify this thread has been solved.

 

For your new needs, 

1. 

Please set the Items property of the ListBox3 to following:

Distinct(
    Filter(
       If(
           !IsBlank(ListBox2.Selected.Result),
           Table,
       ),
       If(
          IsBlank(ListBox1.Selected.Result),
          true,
          Type in ListBox1.SelectedItems.Result
       ),
       If(
          IsBlank(ListBox2.Selected.Result),
          true,
          Location in ListBox2.SelectedItems.Result
       ),
       If(
          FromToFilter = true,
          Weight > Value(txtfrom.Text) && Weight < Value(txtto.Text),
          true
       )
    ),
    Source
)

Set the Default property of the ListBox1 and ListBox2 to following:

""

 

2.

Set the OnSelect property and OnChange property of From Text Input box and To Text Input box to following:

UpdateContext({FromToFilter: false})

 

Best regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Users online (6,230)