cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Thefournier351
Helper I
Helper I

If statement syntax issue

Hi guys I have a question about my syntax issue I’m having. I have a formula with an if statement saying if all my toggles are true, my supervisor check on my excel query is true, but can not finish the final statement. Cause if not all of the toggles are true then the check is false. My statement looks something like && windowstoggle.value=true (“true”)(“false”)}), “”) and on the first bracket infront of (“true”) it says unexpected characters and I can’t fix it
10 REPLIES 10
Drrickryp
Super User
Super User

Hi @Thefournier351

Please post your formula.

Ok but wont put every toggle it’s like 15 minutes of writing lol Its in the studio can’t paste
PreStartStatus: If(AirfilterToggle.Value=false Or BatteryToggle.Value=false, “Shift”, If(ThreePointContactToggle.Value=false, “Plan”, “True”)), SupervisorCheck: If(AirfilterToggle.Value=true && BatteryToggle.Value=true (“true”),(“false”)}), “”)
My mistake is at the final line where true and false are right after each other

OK, I see one problem with  your formula off the bat.

If(AirfilterToggle.Value=true && BatteryToggle.Value=true (“true”),(“false”)}), “”)

There is a right curly bracket that probably shouldn't be there since there is no left curly bracket shown.  Also there appears to be a missing comma between the If() function condition (Airfilter.Toggle.Value=true) and the result of the condition when the condition is true.  The syntax for the If() function is:  If( Condition1, ThenResult1 [, Condition2, ThenResult2, ... [ , DefaultResult ] ] )

 If(AirfilterToggle.Value=true && BatteryToggle.Value=true, “true” , “false”)


I believe my restatement of your formula says that if both toggle values are true, then the return value "true" will be put somewhere and if either of the toggles is not true, then return value "false" will be put in the same location.  Since the two options are mutually exclusive, therre would be no need for a default result so "") is eliminated.  Maybe I'm missing something but If this is not correct, let me know.

 

 

Issue1.pngplease find my attached new issue. the bottom part was indeed fixed.

 the bottom of the formula is now fixed but the top now has an invalid argument

this is the part which has now been fixed for the most part except one highlighted sectionthis is the part which has now been fixed for the most part except one highlighted section

3rd issue right at bottom3rd issue right at bottom

My browser doesn't let me follow the If() statement beyond what is shown in the box.  Could you please isolate the offending statement with the error and repost it. 

BTW, my process for debugging formulas is to isolate each phrase and test if it works, then start connecting them.  

issuepart1issuepart1issuepart2issuepart2issuepart3issuepart3issuepart4issuepart4issuepart5issuepart5

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 (2,048)