Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Conditional Formatting Based on Text Input and Dropdown Choices

Community Beginner ,
Sep 22, 2022 Sep 22, 2022

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.

TOPICS
JavaScript , PDF forms
747
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Beginner ,
Sep 23, 2022 Sep 23, 2022
LATEST

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;

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 22, 2022 Sep 22, 2022

It does make sense, but if you can please share your file, it would be much easier to help you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 22, 2022 Sep 22, 2022

Unfortunately that will not be possible. The document is internal and proprietary. I used generalizations above to demonstrate what I am trying to do. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 23, 2022 Sep 23, 2022

QAManager_0-1663952709156.pngexpand image

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 23, 2022 Sep 23, 2022

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;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 23, 2022 Sep 23, 2022
LATEST

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;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines