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

Help with Nested Filter

Hey there,

 

I have a gallery and three checkbox controls that filter the gallery.  I also have a search bar (Text input) and I would like to search the gallery as the user types.  My code gallery items is below with my checkbox filters working perfectly.  

 

Gallery1.Items=If(GuideChkBox.Value=true,Filter(Wiki,Category in PrimaryCategory.Value||SecondaryCategory_x002d_Optional.Value&&"Guide"in WikiType.Value),TrainingChkBox.Value=true,Filter(Wiki,Category in PrimaryCategory.Value||SecondaryCategory_x002d_Optional.Value && "Training" in WikiType.Value),PolicyChkBox.Value=true,Filter(Wiki,Category in PrimaryCategory.Value||SecondaryCategory_x002d_Optional.Value && "Policy" in WikiType.Value),Filter(Wiki,Category in PrimaryCategory.Value||SecondaryCategory_x002d_Optional.Value))

I can't figure out how to add the text input search so that it also filters/searches when the user types.

 

Any ideas?

2 REPLIES 2
Highlighted
memsim1010
Level: Powered On

Re: Help with Nested Filter

Never mind!  I figured it out.  If anyone else needs the answer, here it is:

If(
    GuideChkBox.Value = true,
    Filter(
        Wiki,
        "Guide" in WikiType.Value && TextInput1.Text in Title && Category in PrimaryCategory.Value || SecondaryCategory_x002d_Optional.Value
    ),
    TrainingChkBox.Value = true,
    Filter(
        Wiki,
        "Training" in WikiType.Value && TextInput1.Text in Title && Category in PrimaryCategory.Value || SecondaryCategory_x002d_Optional.Value
    ),
    PolicyChkBox.Value = true,
    Filter(
        Wiki,
        "Policy" in WikiType.Value && TextInput1.Text in Title && Category in PrimaryCategory.Value || SecondaryCategory_x002d_Optional.Value
    ),
    Filter(
        Wiki,
        TextInput1.Text in Title && Category in PrimaryCategory.Value || SecondaryCategory_x002d_Optional.Value
    )
)
KroonOfficeSol
Level 10

Re: Help with Nested Filter

@memsim1010

 

I think this would be a lot better:

 

Filter(
	Wiki,
	If(GuideChkBox.Value, "Guide" in WikiType.Value, true),
	If(TrainingChkBox.Value, "Training" in WikiType.Value, true),   
	If(PolicyChkBox.Value, "Policy" in WikiType.Value, true),
	TextInput1.Text in Title,
(Category in PrimaryCategory.Value || SecondaryCategory_x002d_Optional.Value) )

The If() formula return true as the condition is false.
btw, you should surround the || you want to check for by ()

 

 

Hope this helps.

 

Paul

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: 43 members 4,907 guests
Please welcome our newest community members: