cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
franky0711
Helper III
Helper III

Combine multiple IF statements

First of all i tried to solve my problem with other threads but i had no success.

Hopefully someone may help me this the follwoing problem:

 

My Sharepoint columns are true/false. Only my last if statement is based on a TEXT column (colum is called "SonstigesThema/Value".

 

For each condition I want to send Mails to different recipient and integrate different mail text.

So i need two almost identical if-statements.

 

One code for the mail text:

 

if(triggerBody()?['Umweltauswirkung2'], 'Umweltauswirkung'),

if(triggerBody()?['Qualit_x00e4_t2'], 'Qualität'),

if(triggerBody()?['Energieeffizienz2'], 'Energieeffizienz'),

if(triggerBody()?['Wirtschaftlichkeit2'], 'Wirtschaftlichkeit'),

if(triggerBody()?['Arbeitssicherheit2'], 'Arbeitsssicherheit'), '')))

 

 

and a code for email adresse

 

 

if(triggerBody()?['Umweltauswirkung2'], 'email1'),

if(triggerBody()?['Qualit_x00e4_t2'], 'email2'),

if(triggerBody()?['Energieeffizienz2'], 'email3'),

if(triggerBody()?['Wirtschaftlichkeit2'], 'email4'),

if(triggerBody()?['Arbeitssicherheit2'], 'email5'), '')))

 

 

I dont get the right code. 

 

I just tried to illustrate my code in the sending-mail-formular.

I know I have to put my code in a function 😉

 

Second question:

Unfortunatly I dont have a basic mode anymore to switch. Where is it gone?

 

Thank you guys for helping

 

1.png

 

2.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @franky0711,

 

If() function should have three parameters:

if(<expression>, <valueIfTrue>, <valueIfFalse>)

If you want to integrate different mail text based on trigger output, I think you should add equals() function into your expression to check specified field if met you want, and then display text, for example:

if(equals(triggerBody()?['Umweltauswirkung2'], 'Umweltauswirkung'),'Text1','Text2')

This is based on the code after your expression has been modified by me:

 

if(triggerBody()?['Umweltauswirkung2'], 'email1',if(triggerBody()?['Qualit_x00e4_t2'], 'email2',if(triggerBody()?['Energieeffizienz2'], 'email3',if(triggerBody()?['Wirtschaftlichkeit2'], 'email4',if(triggerBody()?['Arbeitssicherheit2'], 'email5', '')))))

 

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

 

View solution in original post

6 REPLIES 6

@franky0711 

Hi there.  Have you already considered using the Switch action?  It's great for conditions that don't have a binary T/F Y/N response.

 

Keep us posted.

-Ed

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

franky0711
Helper III
Helper III

Hi @edgonzales  thank you for helping me.  First of all I need to check True/False - see my screenshot in my first post.

 

Is this possible trying with a SWITCH?

Does SWITCH also check TRUE/FALSE?

 

12.png

 

Next problem is: I need an case-dependent function for my email text.

 

If (value;true;TEXT1) see in my first post.

Amanthaper
Responsive Resident
Responsive Resident

Hi @franky0711 

Please help me understand further. Looking at your first example:

Amanthaper_0-1602741887208.png

Are you looking to evaluate the "Umweltauswirkung2" triggerbody() attribute and if it's value is "Umweltauswirkung2" then you want to set (a variable maybe) or change it to "Umweltauswirkung"?

 

Umweltauswirkung2 is my SP-column.

and yepp I need only a STRING if condition sis true.

 

In my different emails I need to add different text / strings like (Umweltauswirkung, Energieeffizienz, Wirtschaftlichkeit, Qualität and Arbeitssicherheit).

 

Hi @franky0711,

 

If() function should have three parameters:

if(<expression>, <valueIfTrue>, <valueIfFalse>)

If you want to integrate different mail text based on trigger output, I think you should add equals() function into your expression to check specified field if met you want, and then display text, for example:

if(equals(triggerBody()?['Umweltauswirkung2'], 'Umweltauswirkung'),'Text1','Text2')

This is based on the code after your expression has been modified by me:

 

if(triggerBody()?['Umweltauswirkung2'], 'email1',if(triggerBody()?['Qualit_x00e4_t2'], 'email2',if(triggerBody()?['Energieeffizienz2'], 'email3',if(triggerBody()?['Wirtschaftlichkeit2'], 'email4',if(triggerBody()?['Arbeitssicherheit2'], 'email5', '')))))

 

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

 

franky0711
Helper III
Helper III

Thank you so much guys 🙂 

 

These statements are wokring now.

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