cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JorPowerViking
Level: Powered On

Filter based on TextInput And Combo-box items only works after first selecting an item and then de-selectinf it

Hi,

I am trying to filter a gallery based on a single text input and a combobox. it seemed to work fine at first. but when i restarted the app my gallery was empty until i selected an item in the combobox. after i de-select the items it keeps working fine. If nothing is selected the gallery shows my hole collection as it is supposed to do.

 

This is my code:

Filter('[dbo].[Devices]'; 
    If( IsEmpty(cbSearchEmployee.SelectedItems); StartsWith(PCType; txtPcTypeSearchInput.Text) ;StartsWith(PCType; txtPcTypeSearchInput.Text) && CurrentUserId in cbSearchEmployee.SelectedItems.Id))

Can someone tell me what i can do to fix this?


1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Filter based on TextInput And Combo-box items only works after first selecting an item and then de-selectinf it

Hi @JorPowerViking 

 

I think I got your problem, I tried to reproduce this issue myself and if you will set the "DefaultSelectedItems" property of your combobox to [] (an empty array) that then will work fine. As it is not having any context of Combobox selections at the start, hence it is not filtering the results. 
 
Hope this Helps!
4 REPLIES 4
Super User
Super User

Re: Filter based on TextInput And Combo-box items only works after first selecting an item and then de-selectinf it

Hi @JorPowerViking 

 

You can try using the expression and this should help you resolve your problem:

 
Filter('[dbo].[Devices]'; If(!IsBlank(txtPcTypeSearchInput.Text);StartsWith(PCType;TextInput3.Text);true) && If(!IsEmpty(cbSearchEmployee.SelectedItems); CurrentUserId in cbSearchEmployee.SelectedItems.Id;true))
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
JorPowerViking
Level: Powered On

Re: Filter based on TextInput And Combo-box items only works after first selecting an item and then de-selectinf it

Thankyou for the reply @yashag2255 ,

However this solution does not seem to work in mij app Smiley Sad
It still gives me a empty gallery until i select a employee in the combobox.

Super User
Super User

Re: Filter based on TextInput And Combo-box items only works after first selecting an item and then de-selectinf it

Hi @JorPowerViking 

 

I think I got your problem, I tried to reproduce this issue myself and if you will set the "DefaultSelectedItems" property of your combobox to [] (an empty array) that then will work fine. As it is not having any context of Combobox selections at the start, hence it is not filtering the results. 
 
Hope this Helps!
JorPowerViking
Level: Powered On

Re: Filter based on TextInput And Combo-box items only works after first selecting an item and then de-selectinf it

many thanks @yashag2255 

This did solve my problem!

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 42 members 4,979 guests
Please welcome our newest community members: