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

Help with multiple filters

Hi all, I'm battling with a multiple filter gallery problem and can't quite get it to work.

Current statement that is working:

SortByColumns(Filter('Tracking List',StartsWith('OB NUMBER', TextInput_OBNum.Text),('Shipment Creator'=Dropdown_Creator.Selected.Result || Dropdown_Creator.Selected.Result= "* All"), ('Freight Status' = Dropdown_ShipmentStatus.Selected.Result || Dropdown_ShipmentStatus.Selected.Result = "* All")),"ID",If(SortDescending1,Ascending, Descending))

 However I have one other column to provide as an option call that "WO NUMBER". The WO NUMBER may have blank data, as soon as I include in the statement it filters out any blank data for those rows. The OB NUMBER always has data so its not much of an issue. Any pointers would be helpful. Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
PowerAddict
Super User II
Super User II

Hi,

 

Just to make sure, you want to add an additional filter "WO NUMBER" which is a column that may have blank data.

Try this:

SortByColumns(Filter('Tracking List',StartsWith('OB NUMBER', TextInput_OBNum.Text),IsBlank(TextInput_WONum.Text) || StartsWith('WO NUMBER', TextInput_WONum.Text),('Shipment Creator'=Dropdown_Creator.Selected.Result || Dropdown_Creator.Selected.Result= "* All"), ('Freight Status' = Dropdown_ShipmentStatus.Selected.Result || Dropdown_ShipmentStatus.Selected.Result = "* All")),"ID",If(SortDescending1,Ascending, Descending))

Added this as an additional filter:

IsBlank(TextInput_WONum.Text) || StartsWith('WO NUMBER', TextInput_WONum.Text)

If the text input control for WO NUMBER is blank, IsBlank will result in true, and hence, the records will not be filtered based on WO NUMBER. However, when its not blank, then the filter will get applied. I assumed you want to do a search similar to what you are doing for OB NUMBER. 

 

Let me know if this helps. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://thepoweraddict.com

View solution in original post

7 REPLIES 7
PowerAddict
Super User II
Super User II

Hi,

 

Just to make sure, you want to add an additional filter "WO NUMBER" which is a column that may have blank data.

Try this:

SortByColumns(Filter('Tracking List',StartsWith('OB NUMBER', TextInput_OBNum.Text),IsBlank(TextInput_WONum.Text) || StartsWith('WO NUMBER', TextInput_WONum.Text),('Shipment Creator'=Dropdown_Creator.Selected.Result || Dropdown_Creator.Selected.Result= "* All"), ('Freight Status' = Dropdown_ShipmentStatus.Selected.Result || Dropdown_ShipmentStatus.Selected.Result = "* All")),"ID",If(SortDescending1,Ascending, Descending))

Added this as an additional filter:

IsBlank(TextInput_WONum.Text) || StartsWith('WO NUMBER', TextInput_WONum.Text)

If the text input control for WO NUMBER is blank, IsBlank will result in true, and hence, the records will not be filtered based on WO NUMBER. However, when its not blank, then the filter will get applied. I assumed you want to do a search similar to what you are doing for OB NUMBER. 

 

Let me know if this helps. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://thepoweraddict.com

View solution in original post

mdevaney
Super User III
Super User III

@Andrew260z1 

I would rewrite your code to look like this

 

SortByColumns(
    Filter(
        'Tracking List',
        StartsWith('OB NUMBER', TextInput_OBNum.Text) Or IsBlank(TextInput_OBNum.Text)=true,
        StartsWith('WO NUMBER', TextInput_WONum.Text) Or IsBlank(TextInput_WONum.Text)=true,
        'Shipment Creator'=Dropdown_Creator.Selected.Result Or IsBlank(Dropdown_Creator.Selected.Result)=true,
        'Freight Status' = Dropdown_ShipmentStatus.Selected.Result Or IsBlank(Dropdown_ShipmentStatus.Selected.Result)=true
    ),
    "ID",If(SortDescending1,Ascending, Descending)
)

 

Instead of using "*All" to display all values use a Blank() instead.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

@mdevaney I think those dropdowns have a value "All" (or something similar) which @Andrew260z1 might want to use as the default value of the dropdown (since otherwise dropdowns resort to the 1st value (or any other value but not blank) as the default value).

 

I would definitely recommend your changes if those would have been combo boxes. Please let me know if I missed anything.

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

 

Thanks!
Hardit Bhatia
https://thepoweraddict.com

Thanks for your help with this, ended up doing it a slightly different way that achieved the same outcome. 

 

If not blank on the TextInput_WONum (yes the dropdowns have other values that can apply to the filter). 

 

SortByColumns(Filter('Tracking List',('Shipment Creator'=Dropdown_Creator.Selected.Result || Dropdown_Creator.Selected.Result= "* All"), ('Freight Status' = Dropdown_ShipmentStatus.Selected.Result || Dropdown_ShipmentStatus.Selected.Result = "* All"), If(!IsBlank(TextInput_WONum),StartsWith('WO NUMBER',TextInput_WONum.Text),StartsWith('OB NUMBER',TextInput_OBNum.Text))),"ID",If(SortDescending1,Ascending, Descending))

 

Glad I could help! Good luck with the rest of the app! Feel free to reach out in case of any questions!

Thanks!
Hardit Bhatia
https://thepoweraddict.com

@PowerAddict

Fair enough.   It also looks like we were typing at the same time.  If I knew you had already answered I would not have submitted my response too.

No worries, has happened to me multiple times 🙂 Glad we were thinking along the same lines!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (81,608)