cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ML147243
Helper II
Helper II

Using if(contains) statement in update item.

Hello,

 

I am still learning this correct formatting and syntax for this system. I have a list with multiple columns and shown. I would like to add a Role column that updates based on the class that was selected. My current flow works for the function in the Totals for class, so it is likely how the If statement is written. I get an error message about the number of characters.

Any help is appreciated. Thank you.

list.jpg

flow update.jpgedited to add a better picture of If statement.

 

if statement.jpg

  

1 ACCEPTED SOLUTION

Accepted Solutions

My guess would be that you're missing one or more closing brackets. Try to put the whole expression in some code editor, e.g. 'Visual Studio Code' to check if every opening bracket has also a closing bracket.



[ 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

5 REPLIES 5
tom_riha
Super User
Super User

Hello @ML147243 ,

the if(...) should be entered as an expression, not as a string.



[ 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. ]

@tom_riha Hi Thanks,

Yes, I have tried to enter it as an expression and I get that the expression is invalid. 

My guess would be that you're missing one or more closing brackets. Try to put the whole expression in some code editor, e.g. 'Visual Studio Code' to check if every opening bracket has also a closing bracket.



[ 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. ]
ML147243
Helper II
Helper II

So it was that I was using " instead of ' . The flow isn't working though, I tried changing class to class value but it still is not working. 

after some tweaking, this was what worked,

 

if(contains(triggerBody()?['Class/Value'],'EDM RN'),'RN',

if(contains(triggerBody()?['Class/Value'],'Tech'),'CNA',

if(contains(triggerBody()?['Class/Value'],'CNA'),'CNA',

if(contains(triggerBody()?['Class/Value'],'HUC'),'HUC',

if(contains(triggerBody()?['Class/Value'],'SIS RN'),'RN',

if(contains(triggerBody()?['Class/Value'],'RN'),'RN',

if(contains(triggerBody()?['Class/Value'],'HF'),'RN',

if(contains(triggerBody()?['Class/Value'],'student'),'SN',

if(contains(triggerBody()?['Class/Value'],'SCM RN'),'RN',

If(contains(triggerBody()?['Class/Value'],'Athena'),'HFMG','other'))))))))))

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (2,462)