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

Sharepoint multi choice column, check if value exists in the selections.

Hi!

so, I'm pulling in data from a SharePoint list and have a multi select column it is just a choice of 1-12 to indicate months and trying to check if the current month is in the list but the "contains" in the condition here: 

miguelrodrigue_0-1612542673036.png

is always evaluating to false

 

I even did a join operation and emailed it to myself to check if the value is correct and it looks like it is

miguelrodrigue_1-1612544348550.png

the 2 twos is just grabbing this month and then I wanted to cast it to an int to check if it changed at all.

but I can't see a reason why it wouldn't be comparing the two

1 ACCEPTED SOLUTION

Accepted Solutions
tom_riha
Super User II
Super User II

Hello @Anonymous ,

with multiple choice columns it's a bit more complicated than simple 'contains' as the column doesn't contain just the values, but whole objects with the value (@odata.type, Id and Value).

To check if a value is selected in a multiple choice column, I'd initialize a boolean variable and set it to 'false', then loop through all the values ('Choice Value' dynamic content) and compare it with the value. If it's equal, set the variable to 'true'. At the end of the loop, the variable will be either 'false' (not contains) or 'true' (value was among the choices).

And don't use the int(...) expression for the value, try string(...) or nothing instead as the column/array values are of a string type by default.

image.png



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

2 REPLIES 2
Hardesh15
Super User II
Super User II

@Anonymous  pls check your condition in left side. This is a variable which holding month value. What is the type of variable here?

Please 'Thumbs Up' the posts that helped you and 'Mark as Solution' if my post answered your question.

@Hardesh

tom_riha
Super User II
Super User II

Hello @Anonymous ,

with multiple choice columns it's a bit more complicated than simple 'contains' as the column doesn't contain just the values, but whole objects with the value (@odata.type, Id and Value).

To check if a value is selected in a multiple choice column, I'd initialize a boolean variable and set it to 'false', then loop through all the values ('Choice Value' dynamic content) and compare it with the value. If it's equal, set the variable to 'true'. At the end of the loop, the variable will be either 'false' (not contains) or 'true' (value was among the choices).

And don't use the int(...) expression for the value, try string(...) or nothing instead as the column/array values are of a string type by default.

image.png



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA 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

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 Kudoed Authors
Users online (2,458)