Skip to main content
davidm76220796
Known Participant
November 10, 2016
Answered

Changing Field Background Color with dependancies

  • November 10, 2016
  • 5 replies
  • 951 views

Why am I getting a Syntax error 7?

var Red10=this.getField ("Red10").value;

var N36=this.getField ("N36").value;

var N37=this.getField ("N37").value;

var P28=this.getField ("P28").value;

var L30=this.getField ("L30").value;

(function (){

if (P28)>=(N36)

&&

if (P28)<=(N37)

&&

if(Red10)>=(L30)

event.target.fillColor=color.yellow;

})();

Thanks

dkm

This topic has been closed for replies.
Correct answer try67

Go to line #7 of your code and examine it carefully... Read the full text of the error message. It will help you identify the problem.

5 replies

Inspiring
November 11, 2016

You should also place those var statements within the function. It will make them local to the function, which is the primary reason for using it in the first place. This isn't the source of the syntax error though. You should have a single if statement and include an else block to that the color is set to something else if the condition isn't met.

davidm76220796
Known Participant
November 11, 2016

Wow!   Those Parenthesis are tricky little buggers, aren't they?  Thanks for all your help!  :-)

(function (){

var Red10=this.getField ("Red10").value;

var N36=this.getField ("N36").value;

var N37=this.getField ("N37").value;

var P28=this.getField ("P28").value;

var L30=this.getField("L30").value;

if (((P28)>=(N36))

&&

((P28)<=(N37))

&&

((Red10)>=(L30)))

event.target.fillColor=color.yellow;

else

event.target.fillColor=color.white;

})();

try67
Community Expert
Community Expert
November 11, 2016

There's really no need to use that many of them... You can replace this statement:

if (((P28)>=(N36)) && ((P28)<=(N37)) && ((Red10)>=(L30)))

With this:

if (P28>=N36 && P28<=N37 && Red10>=L30)

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
November 10, 2016

Go to line #7 of your code and examine it carefully... Read the full text of the error message. It will help you identify the problem.

Inspiring
November 10, 2016

Check your syntax.