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 / How to apply filter ba...
Power Apps
Unanswered

How to apply filter based two conditions on listbox

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Mates,

There are three listboxes(lstb1,lstb2,lstb3)  and two textboxs(txtfrom, txtTo) field is Weight (ex. 1-100, 200-500 etc.)

Input Parameters : listbox(lstb1,lstb2) items and textbox with From -To Values.

OutPut : Listbox3(lstb3)

Action/Trigger : Button to filter on lstb3

lstb1 loading Table.type Vaues Item: Distinct(Filter(Table,Type <>""),Type) 

lstb2 loading Table.source Values item: Distinct(Filter(Table,Source <>""),Source)

lstb3 loading Table.Location Values item: 

 

if(CountRows(Gallery.Allitems)=0,Distinct(Filter(Table,Location <>""),Location),filterColl)

 

here we also have two textboxs to filter lstb3 values based  textboxs.

Button : OnSelect : 

 

ClearCollect(filterColl,Distinct(Filter('Table,Weight>Value(txtfrom.Text),Weight<Value(txtto.Text)),Location));

 

Current behavior in shot:

lstb3 is loading default values Location : this is correct as expected 

selecting items from lstb1, lstb2  and input from -to values then only lstb3 loading/Filtering when press the button but 

how to load/filter values when selected lstb1,lstb2 items with out From -To values.

Means user want to filter lstb3 on two condtion

1. when select the input parameters from lstb1, lstb2 items And txtfrom -txtTo(weight) values. 

2. when select the input parameters from lstb1, lstb2 items

when trigger/button clicks then  above condition 1 is filtering location values working as expected. But user also want to filter

with-out entering From-To Values, means only with lstb1,lstb2 items

how to filter with skip if From-To is blank, if not Blank then consider From-To textbox values in the same button.

With the above button formula i can filter when only enter the From-To values but not with blank. 

 

Any body can help me here.

how can apply filter if From-To is blank then filter based lstb1,lstb2 values, if not Blank then consider From-To textbox values in the same button. kindly help me code.

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous 

    In principle, you do it by creating a variable from the selected items in the listbox and then filtering the gallery according to the presence of the Column being filtered in the variable.  Not getting into the details of your code, in the OnSelect property of the listbox  put UpdateContext({vSelectedItems: ListBox1.SelectedItems.Result}) and in the items property of your gallery  Filter(datasource, ColumnBeingFiltered in vSelectedItems)

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Drrickryp ,

    thanks for reply, but still i need little help here,

    I have 3 listbox here, for which list box onSelect i have to create updatecontext and we dont have any gallery here.

    if possible Steps will be helpful here.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Anonymous 

    I'm confused about what you are trying to do.  Could you provide a screenshot that demonstrates the problem?

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 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard