cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
patty789
Helper V
Helper V

Issue with If statements

Hello,

 

I am currently having an issue with an IF statement. So i have a button that on the displaymode property i am only showing if this statement is true if(!IsEmpty(Filter(Datasource, Status.Value = "Cancel Request" || Status.Value = "Active")),DisplayMode.Disabled,Edit)

but i want to add another if to check if the status is changed by the admin of the SharePoint list to Canceled, and to display the button. How can i add this? Any help will be appreciated. 

 

Thank you

7 REPLIES 7
Drrickryp
Super User
Super User

Hi @patty789 

It is not clear to me what the context of your issue is.  Are you referring to a button on an Edit form?

@Drrickryp its a button. 

I got that.  Where is the button and what are you trying to do with it?  Could you provide a screenshot?

@Drrickryp the button is on the beginning of the app. What i am trying to do is to only display the button based on certain conditions trigger by the user that submits the request and also by the admin of the SharePoint list that is getting edited. 

 

patty789_0-1595443124372.png

 

@patty789 

Do you have to identify the Admin as the user to check on the list?

@Drrickryp no i don't as they are not going to access the app. They will only be using the SharePoint list for editing the Status Column. 

Hi @patty789 

 

If(
    !IsEmpty(
             Filter(Datasource, User().FullName =adminname AND Status.Value = "Cancelled"
                 ), DisplayMode.Edit 
      ),
    !IsEmpty(
               Filter(
                      Datasource, Status.Value = OR(
                                                   "Cancel Request" ,"Active"
                                                 )
                   ),DisplayMode.Disabled
      ),
      DisplayMode.Edit
)

 

I believe this formula will test to see first, if the User is the administrator and the status is "Cancelled", it that is true then the Display mode is Edit and the rest of the statement is ignored.  If that test fails because the filter is empty, then the next test is to see if the status value is either "Cancel Request" or "Active'.  If that is true then the display mode is disabled and the rest of the statement is ignored and the display mode is set to Edit.   If statements will execute conditions in order until the first true condition is found.  So, it is important to put the conditional statements in the right order. 

If my logic is wrong, we should be able to work on each condition until it is correct.

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 (1,505)