cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
BrandonMcNabb
Level: Powered On

multiple If staements not working properly

I have a checksheet app Ive been working on for a few days now and I want to set a status when:

   -no boxes are checked=Incomplete

   -some are checked but not all=Incomplete

   -all boxes are checked=Complete

Right now I can get it to do the first and sort of the last objective but not the second. This is my current code.

 

If(
    Check1 = true,
    If(
        Check2 = true,
        If(
            Check3 = true,
            If(
                Check4 = true,
                If(
                    Check5 = true,"
                    If(
                        Check6 = true,
                        If(
                            Check7 = true,
                            If(
                                Check8 = true,
                                If(
                                    Check9 = true,
                                    "Complete",
                                    "Incomplete"
                                )
                            )
                        )
                    )
                )
            )
        )
    )
)

any help would be much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: multiple If staements not working properly

@BrandonMcNabb 

In this case you are going to want to And (&&) all of these together rather than multiple If's

  If(Check1 && Check2 && Check3 && Check4 && Check5 && Check6 && Check7 && Check8 && Check9, "Complete", "Incomplete")

 

However, there might be even easier ways to do this depending on where your check boxes are.  

Are they free-form (just a bunch of check boxes you've put on the screen) or are they part of a Gallery list?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

4 REPLIES 4
Super User
Super User

Re: multiple If staements not working properly

@BrandonMcNabb 

In this case you are going to want to And (&&) all of these together rather than multiple If's

  If(Check1 && Check2 && Check3 && Check4 && Check5 && Check6 && Check7 && Check8 && Check9, "Complete", "Incomplete")

 

However, there might be even easier ways to do this depending on where your check boxes are.  

Are they free-form (just a bunch of check boxes you've put on the screen) or are they part of a Gallery list?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

BrandonMcNabb
Level: Powered On

Re: multiple If staements not working properly

They are attached to different data cards and activate and update context variable so it will auto populate the ID and Date into 2 different datacards. I hope this picture helps.

BrandonMcNabb
Level: Powered On

Re: multiple If staements not working properly

I did just try what you suggested and it worked like a charm, thank you so much. my final code looks like this:

If(
    Check1 = true && Check2 = true && Check3 = true && Check4 = true && Check5 = true && Check6 = true && Check7 = true && Check8 = true && Check9 = true,
    "Complete",
    "Incomplete"
)

 

Super User
Super User

Re: multiple If staements not working properly

@BrandonMcNabb 

Excellent!! Yes, if these are all seperate and unique controls, then that would be the way.  If they were part of a Gallery, you could use a formula to check the condition, but it looks like you are on your way now.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (5,328)