cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ricky76
Frequent Visitor

Ignore filter in dropdown when IsBlank

Hello

 

I'm building a very small app based on data from a Sharepoint list. I generated the app from the "Integrate" option directly from the Sharepoint list. However I'm still struggling with the syntax, despite finding some examples on what I want to achieve.

 

I have a SearchTextBox and then a Dropdown. The Dropdown is acting as a filter.

 

I want to ignore the filter if the selected value is blank. I entered a record in the Sharepoint list with a blank value so that it would populate my dropdown menu.

 

So my Dropdown1 has this:

 

Items = Sort(Distinct('Kontaktlista DP';DeviceProviderType);Result; Ascending)

 

 

Then in the BrowseGallery1 I have this:

 

Search(Filter('Kontaktlista DP';DeviceProviderType = Dropdown1.Selected.Result);
TextSearchBox1.Text;
   "Title";
   "field_Namespace";
   "field_PODName"   
)

 

 

And naturally I then have a SearchTextBox1 with no applied code or formulas.

 

Everything here works, but I cant figure out how to put an IF-statement to ignore the Filter is the selected value is blank/null/nothing...

 

Any friendly soul out there who can point me in the right direction?

1 ACCEPTED SOLUTION

Accepted Solutions

@Ricky76 Try this,

 

Search(Filter('Kontaktlista DP';
	If((IsBlank(Dropdown1.Selected) Or IsBlank(Dropdown1.Selected.Value)); true; DeviceProviderType = Dropdown1.Selected.Result));
	TextSearchBox1.Text;
	   "Title";
	   "field_Namespace";
	   "field_PODName"   
)

 

View solution in original post

5 REPLIES 5
CNT
Super User
Super User

@Ricky76 Try this,

Search(Filter('Kontaktlista DP';
	If(IsBlank(Dropdown1.Selected), true, DeviceProviderType = Dropdown1.Selected.Result));
	TextSearchBox1.Text;
	   "Title";
	   "field_Namespace";
	   "field_PODName"   
)
Ricky76
Frequent Visitor

@CNT Many thanks for the help, appreciated.

 

I had to do some modifications to the syntax (mainly replacing "," with ";"), but it's still not ignoring the filter when a blank value is selected from Dropdown1.

 

This is the slightly modified code I used:

Search(Filter('Kontaktlista DP';
	If(IsBlank(Dropdown1.Selected); true; DeviceProviderType = Dropdown1.Selected.Result));
	TextSearchBox1.Text;
	   "Title";
	   "field_Namespace";
	   "field_PODName"   
)

 

I'm stating to think that a blank/empty cell in Sharepoint really isnt blank/empty at all. Could that be the case? The Dropdown1 Filter is working as it should, but when I select a record where coloumn "DeviceProviderType" is blank/empty, the BrowseGallery1 will still use the filter and only show records where "DeviceProviderType" has blank/empty value.

@Ricky76 Try this,

 

Search(Filter('Kontaktlista DP';
	If((IsBlank(Dropdown1.Selected) Or IsBlank(Dropdown1.Selected.Value)); true; DeviceProviderType = Dropdown1.Selected.Result));
	TextSearchBox1.Text;
	   "Title";
	   "field_Namespace";
	   "field_PODName"   
)

 

Ricky76
Frequent Visitor

I understand now 🙂 Just had to do some slight modification to get it to work for me. I had to set it do "Dropdown1.Selected.Result" and then it works! Many, many thanks.

 

Should I mark your latest post as "Accept as Solution"?

 

This is what works for me:

 

Search(
    Filter(
        'Kontaktlista DP';
        If(
            (IsBlank(Dropdown1.Selected.Result));
            true;
            DeviceProviderType = Dropdown1.Selected.Result
        )
    );
    TextSearchBox1.Text;
    "Title";
    "field_Namespace";
    "field_PODName"
)

 

@Ricky76 Yes please! 🙂

Helpful resources

Announcements
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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,397)