Copy link to clipboard
Copied
I have a form where we record angles from 3 sides. Call them Pos 1, Pos 2, Pos 3. I have a column called Angle Average that averages those three numbers. Now we have 4 different items that are measured with different angle requirments. Call them 10, 11, 12, 13. I have a drop down that lets you pick the item and then the Angle requirement populates in the next box.
What I'm trying to do is two-fold:
1) I would like to get the Angle Average box to color Green or Red if it equals or is less then the Angle requirement for the selected Item
2) I want to use 1 form for all 4 items. So picking the Item from the dropdown would change the Angle requirement and therefore the Angle Average coloring would be based on that angle.
So if I picked Item 10 with a 21 angle requirement then the Angle average box would color green or red based on if the average was less then or equal to 21. But if I picked Item 11 and the angle changed to 30 then the Angle Average box would change to green or red based on if it was less then or equal to 30.
I hope this makes sense. I've gotten most of the formula in but I can't quite make this work.
Copy link to clipboard
Copied
Got it to work!
var an = this.getField("Text4").value;
var ma = this.getField("Text108").value
if(Number(an)<= (Number(ma)))
event.target.fillColor = color.green;
else event.target.fillColor = color.red;
Copy link to clipboard
Copied
It does make sense, but if you can please share your file, it would be much easier to help you.
Copy link to clipboard
Copied
Unfortunately that will not be possible. The document is internal and proprietary. I used generalizations above to demonstrate what I am trying to do.
Copy link to clipboard
Copied
Here is a redacted screen shot. Basically I am trying to get a formula that will compare the Angle average to the Maximum Included angle. If the Angle average is less then or equal to the Max Included Angle I want the box color to change to green. If not I want the box to highlight as red. I hope that helps. I'm working on formatting some code right now and I'll post what I have soon but any guidance in the meantime would be appreciated.
Copy link to clipboard
Copied
Here is the code I've come up with so far (it doesn't work)
var an = this.getField("Text4").value;
var ma = this.getField("Text108").value
if(Number(an)<= (Number(ma)))
event.target.textColor = color.green;
else event.target.Color = color.red;
Copy link to clipboard
Copied
Got it to work!
var an = this.getField("Text4").value;
var ma = this.getField("Text108").value
if(Number(an)<= (Number(ma)))
event.target.fillColor = color.green;
else event.target.fillColor = color.red;