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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

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.

Top Solution Authors
Top Kudoed Authors
Users online (1,236)