cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jackywei_BDF
Super User
Super User

How to use if function to deal with two condition items?

Dear all:

 

I am a starter for power apps with sharepoint.

Now i have one question about how to use IF function.

The situation is that i have a condition, if the condition "ApproverEmail" is Blank(), then send email to user().Email for "TEST1", if the condition "ApproverEmail is not Blank(), then send email to User().Email for "TEST2"

IF ApproverEmail = Blank() Then send email to User().Email for "TEST1"

IF ApproverEmail <> Blank() Then send email to User().Email for "TEST2"

But i don't know how to write IF function by Power apps for above case.

 

Would you please help me ?

Thanks a lot!

1 ACCEPTED SOLUTION

Accepted Solutions
iAm_ManCat
Super User
Super User

If(
   //Condition 1
   ApproverEmail = Blank()
   ,
   //Result 1
   "Then send email to User().Email for TEST1 "
   ,
   //Condition 2
   ApproverEmail <> Blank()
   ,
   //Result 2
   "Then send email to User().Email for TEST2 "
)

 

Change the text part to the actual function for sending emails as you have in your app, but this is the correct If function formatting

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

3 REPLIES 3
iAm_ManCat
Super User
Super User

If(
   //Condition 1
   ApproverEmail = Blank()
   ,
   //Result 1
   "Then send email to User().Email for TEST1 "
   ,
   //Condition 2
   ApproverEmail <> Blank()
   ,
   //Result 2
   "Then send email to User().Email for TEST2 "
)

 

Change the text part to the actual function for sending emails as you have in your app, but this is the correct If function formatting

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


@iAm_ManCat :

 

Yes, it is working now.

Sorry for later reply.

By the way, it is possible i run two steps for one condition?

For example:

If(

 ApproverEmail = Blank()

,

Send Email to user & Patch( list1, { ApprovalStatus : "Approved" })

)

 

 

Thanks for your support:)

Yes of course 🙂

 

You can separate additional code within the same step with a semi-colon like this:

 

If(
   //Condition 1
   ApproverEmail = Blank()
   ,
   //Result 1
   "Then send email to User().Email for TEST1 " ;
   Patch(DataSource, Lookup(datasource, ID = ThisItem.ID), {ApprovalStatus: "Approved"}) ;
   Navigate('Home Screen')
   ,
   //Condition 2
   ApproverEmail <> Blank()
   ,
   //Result 2
   "Then send email to User().Email for TEST2 "
)

 

You can add as many extra steps as you want, and you can also add additional If statement checks by putting another comma in and having a third condition that gives a third result etc etc

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


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 (4,545)