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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,089)