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

Multiple IF expression to create Item name

Hi, I need a little help with basic, I hope, expression in Power automate.

I have 3 columns in my Sharepoint list, named Column1, Column2 and Column3. What I would like is to auto populate a value for 1st column, based on the values in 2nd and 3rd column.

For example. If Column2 has value "Cat" and Column3 value "Dog" I would like to have in Columns1 value "CatDog"

or

If Column2 column has vale "Cat" and Column3 value "Fish" I would like to have in Column1 "CatFish"

I know it can be done with condition in Power automate steps, but I guess it is also possible with IF expression, I just need a sample of that multiple syntax. Can you help?

I

6 REPLIES 6
Soundharya
Helper III
Helper III

Soundharya_0-1643641979212.png

 

cnapan
Helper I
Helper I

Well, thank you @Soundharya , but what if I have more combination in Column2 or Column3, except cat, dog and frish, there is also a pig, horse, elephant. Can I somehow a write

if(Equals(triggerBody()['Column1'],'cat' and ['Column2']'), 'dog', 'catdog' '')
or something similar but more complex to achieve my goal?

You can add compose action and below expression

if(and(contains(variables('Name'), 'cat'),contains(variables('Name1'), 'fish')),'catfish',if(and(contains(variables('Name'), 'cat'),contains(variables('Name1'), 'dog')),'catdog',''))
Soundharya_4-1643644134785.png

 


Soundharya_2-1643644078852.png

 


Thank you, @Soundharya that would work, but can you show me all steps of the flow how this supposed to be constructed? I do not know, where to place the initialized variables. Thank you.

To show you example i have used variables, instead of variables you can use your columns or fields directly here

I did replace variables with column name, then getting syntax error 😞 Why?

if(and(contains(['Animal1'], 'cat'),contains(['Animal2'], 'dog')),'catdog',if(and(contains(['Animal3'], 'fish'),contains(['Animal1'], 'cat')),'fishcat',''))

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.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

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.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,820)