Code assistance for calculation and color
I am hoping someone familiar with java can help. (I am new to this type of script). I created a pdf form and am struggling with formatting 2 of the cells. The first cell is a drop down. I want it to fill green if "pass" is chosen and red if "fail" is chosen, but remain white if neither are chosen. Here is what I came up with, but I keep getting a syntax error:
if (event.value=="Pass") {
event.target.fillColor = color.green;
if (event.value=="Pass") {
event.target.fillColor = color.green;
if (event.value=="Fail") }
event.target.fillColor = color.green;
} else {
event.target.fillColor = color.white;
}
The other cell I am trying to format needs to sum the values of 3 other cells and if they are =>4452 AND at least one of the cells is >=1500 I need the cell to fill green. If both statements are not true, I need it to fill red.
This is what I have come up with so far. I am not getting an error, but it is also not working:
let "LitBestScore" = /* your value */;
let "AlgBestScore" = /* your value */;
let "BioBestScore" = /* your value */;
// Check if the sum is >= 4452 and at least one cell is 1500 or higher
if (("LitBestScore" + "AlgBestScore" + "BioBestScore") >= 4452 && ("LitBestScore" >= 1500 || "AlgBestScore" >= 1500 || "BioBestScore" >= 1500)) {
console.log("Yes");
} else {
console.log("No");
}
var v = Number(event.value);
if (v>=0 && v<=4451) {event.target.fillColor = color.red;}
else if (v>4451) {event.target.fillColor = color.green;}
