cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
p0werSn3k
Regular Visitor

Filter Gallery Results (from Sharepoint list) based off of collection value

I'm trying to filter the gallery results based off a collection value. The below example works - 

 

Filter([@'SharePointList'], 'Value1orValue2'.Value = "Value1")

Instead of the string "Value1" I want to filter from the value of a collection item - FilterList.Value1orValue2 but I keep getting errors.

I've tried -

Filter([@'SharePointList'], 'Value1orValue2'.Value = FilterList.Value1orValue2)

and

Filter([@'SharePointList'], 'Value1orValue2'.Value = First(FilterList.Value1orValue2)

 

and some variations of those but no luck. Any advice?

 

FYI the sharepoint list has a column title Value1orValue2 with two choices. The collection - FilterList has the same column title & possible values.

1 ACCEPTED SOLUTION

Accepted Solutions

Filter([@'SharePointList'}, Value1orValue2.Value in Concat(FilterList, Value1orValue2) 

 Ended up working. Thanks for the advice!

View solution in original post

8 REPLIES 8
KrishnaV
Super User
Super User

Hi @p0werSn3k ,

 

try this:

Filter([@'SharePointList'], 'Value1orValue2'.Value = First(FilterList.Value1) Or 'Value1orValue2'.Value = First(FilterList.Value2))

 
I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

That doesn't work. It shows the '=' as an invalid operator type. If I use 'in' for the operator I get a 'Cannot use Record values in this context' error

Hi @p0werSn3k ,

 

sorry that is my bad, try this:

Filter([@'SharePointList'], 'Value1orValue2'.Value = First(FilterList).Value1 Or 'Value1orValue2'.Value = First(FilterList).Value2)

 
I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
v-xida-msft
Community Support
Community Support

Hi @p0werSn3k ,

Could you please share a bit more about the "Value1orValue2" column? Is it a Choice type column?

Do you want to filter your Gallery Items based on the collection value (FilterList)?

 

According to the needs that you mentioned, I think there is something wrong with your Filter formula. Within your Filter formula, the 'Value1orValue2'.Value formula returns a Text value, but the FilterList.Value1orValue2 formula returns a Table value. You could not compare a Text value with a Table value using '=' operator directly.

 

I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the Gallery to following:

Filter(
       [@'SharePointList'],
       Value1orValue2.Value in Concat(FilterList, Value1orValue2.Value & ";")
)

or

Filter(
       [@'SharePointList'],
       Value1orValue2.Value in ForAll(
                                      FilterList,
                                      Value1orValue2.Value
                               )
)

 

Please consider take a try with above solution, hopes it could solve your problem.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-xida-msft Yes, Value1orValue2 is a choice type column & I want to filter the gallery items based on the corresponding collection value. I'll try your solution and report back. 

Hi @p0werSn3k ,

Have you taken a try with the solution I provided above? Is it helpful?

 

Please take a try with the solution I provided above, then check if the issue is solved. If you have solved your problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Filter([@'SharePointList'}, Value1orValue2.Value in Concat(FilterList, Value1orValue2) 

 Ended up working. Thanks for the advice!

Hi @p0werSn3k ,

Have you solved your problem? Is the solution I provided above helpful in your scenario?

 

If the solution I provided above is helpful in your scenario, please also consider go ahead to click "Accept as Solution" to identify my reply as Solution.

 

Regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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,889)