cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to use Or operator in filtering

Hi, i need to use the or operator in this case...

 

I have a SP list with 4 column.

Regionold; regionold2; regionold3; region

 

Region is like a state. I need to filter the user region actually in use with the new region. 

For that, 

 

1. I Check the region of the user with office365user

2- if he lives in regionold, print the value in region; if he lives in region2 print region, if he lives in region3 print region.

 

To test that i add a combobow with this formula

 

'Utilisateursd''Office365'.SearchUser({searchTerm:ComboBox1.SearchText;top:100}).Mail

 

then i add a dropdown control and i add ths formula

 

Filter(Base_region_centre_update; Region_Old Or Region_Old2 Or Region_Old3='Utilisateursd''Office365'.UserProfileV2(ComboBox1.Selected.Mail).companyName).Region

 

but it's not working. If i tried to filter with only Region_old it's working. 

 

My sp looks like this

 

ALP1_0-1633352231975.png

 

the attribut compagnyname is where are stored the user region in our AAD

 

I use this formula to check this

 

'Utilisateursd''Office365'.UserProfileV2(ComboBox1.Selected.Mail).companyName

 

 

 

Can you help me. What am i missing ?

Thanks

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
BCLS776
Super User
Super User

Each condition in the filter needs to return true or false  on its own - a column name alone does not do that. Try this version, using a With() to avoid a lot of repetition of code:

With({ aRegion: 'Utilisateursd''Office365'.UserProfileV2(ComboBox1.Selected.Mail).companyName.Region};
Filter(Base_region_centre_update; aRegion = Region_Old || aRegion = Region_Old2 || aRegion = Region_Old3 || aRegion = Region)
)

I prefer to use the || notation to denote OR. This filter returns any records that have the user's region in any of those four columns. I wasn't sure how that fit into the dropdown or combobox you mentioned, but this should get you started.

 

Bryan

 

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
BCLS776
Super User
Super User

Each condition in the filter needs to return true or false  on its own - a column name alone does not do that. Try this version, using a With() to avoid a lot of repetition of code:

With({ aRegion: 'Utilisateursd''Office365'.UserProfileV2(ComboBox1.Selected.Mail).companyName.Region};
Filter(Base_region_centre_update; aRegion = Region_Old || aRegion = Region_Old2 || aRegion = Region_Old3 || aRegion = Region)
)

I prefer to use the || notation to denote OR. This filter returns any records that have the user's region in any of those four columns. I wasn't sure how that fit into the dropdown or combobox you mentioned, but this should get you started.

 

Bryan

 

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
Anonymous
Not applicable

Wahouu i'm so impressed. I didn't knew With function. It's powerful. I watched a video from shane young to learn more.

 

I modified the formula like this

 

With({aRegion:'Utilisateursd''Office365'.UserProfileV2(ComboBox1.Selected.Mail).companyName};Filter(Base_region_centre_update;aRegion=Region_Old||aRegion=Region_Old2||aRegion=Region_Old3||aRegion=Region))

 

You forgot to remove .region after compagnyname.

It works like a charm. Thank a lot

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,514)