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

Gallery filter with multiple startswith

Hi all,

 

I've been trying to filter a list using multiple values. I notice that it won't return anything unless I'm filling out each value, I've tried to test if the value is not blank then to not trigger the StartsWith but it won't return me anything at all unless each value has some data. I am also filtering a collection that is larger than 2000 items so hence the reason I'm using startswith.

 

 

Filter(CO_ALL,If(!IsBlank(cmb_SPID.Selected.SPID),StartsWith(SERVPROV_ID,cmb_SPID.Selected.SPID)),If(!IsBlank(cmbOrigin.Selected.Result),StartsWith(TMS_ORIGIN_PARENT_CITY,cmbOrigin.Selected.Result)))

 

01.png2.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User III
Super User III

Hi @Andrew260z1 ,

Try this

Filter(
   CO_ALL,
   If(
      IsBlank(cmb_SPID.Selected.SPID),
      true,
      StartsWith(SERVPROV_ID,cmb_SPID.Selected.SPID)
   ) &&
   If(
      IsBlank(cmbOrigin.Selected.Result),
      true,
      StartsWith(TMS_ORIGIN_PARENT_CITY,cmbOrigin.Selected.Result)
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

6 REPLIES 6
WarrenBelz
Super User III
Super User III

Hi @Andrew260z1 ,

Try this

Filter(
   CO_ALL,
   If(
      IsBlank(cmb_SPID.Selected.SPID),
      true,
      StartsWith(SERVPROV_ID,cmb_SPID.Selected.SPID)
   ) &&
   If(
      IsBlank(cmbOrigin.Selected.Result),
      true,
      StartsWith(TMS_ORIGIN_PARENT_CITY,cmbOrigin.Selected.Result)
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Florian_Kleinz
Resolver II
Resolver II

Hello,

 

please try to put 'true' in the else part of your if statement.

Filter(CO_ALL, 
  If(!IsBlank(cmb_SPID.Selected.SPID),StartsWith(SERVPROV_ID,cmb_SPID.Selected.SPID),true), 
  If(!IsBlank(cmbOrigin.Selected.Result),
    StartsWith(TMS_ORIGIN_PARENT_CITY,cmbOrigin.Selected.Result),
    true
  )
)

This way you apply true as your filter condition which simpy does nothing.

Filter(Items,true) //gives you all items

 

Best regards

@Florian_Kleinz ,

Pretty much what I said.

@WarrenBelz, yes I know. I was already preparing the answer and did recognize your post in the meantime.

 

Sorry for that. Didn't want to give you the impression of having copied your solution.

 

Best regards

@Florian_Kleinz ,

No problems - it is a good idea to refresh before you post - it saves you effort at times.

thank you both for the responses. I couldn't find this with a general Google search, appreciate it.

 

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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,230)