I have an application where I wish to set the background color of a field to red when a measured value is found to be greater than an allowed tolerance. The allowed tolerance is extracted from a lookup table using a calculated field. This calculated value is calculated before the measurement is entered. For example, in the Submission datapage shown below a Job No is first selected, then a Motor RPM value is obtained from one lookup table and the Tolerance = 0.003 is obtained as a calculated value from another lookup table. The User then enters a value for Fan. This all works fine; however, the code that reads the calculated value for Tolerance does not. See below......
The calculated field is shown below.
HTML block 3 is used to set the background color when Fan > Tolerance. The HTML block is positioned following the fields shown above. The field labeled Fan is ODE_Fan_TIR. The field labeled Tolerance is ODE_Labyrinth_Tol. Since Fan > Tolerance the background color of the Fan field should be red.
In the script shown below, a console error indicates that the calculated field value (Tol) is null. The error occurs in the following line of code " let tol = document.getElementById("InsertRecordODE_Labyrinth_Tol").value;"
How does one obtain and use a calculated value in an IF statement before the Submit button is pressed?
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
BillW
Hi,
I have an application where I wish to set the background color of a field to red when a measured value is found to be greater than an allowed tolerance. The allowed tolerance is extracted from a lookup table using a calculated field. This calculated value is calculated before the measurement is entered. For example, in the Submission datapage shown below a Job No is first selected, then a Motor RPM value is obtained from one lookup table and the Tolerance = 0.003 is obtained as a calculated value from another lookup table. The User then enters a value for Fan. This all works fine; however, the code that reads the calculated value for Tolerance does not. See below......
The calculated field is shown below.
HTML block 3 is used to set the background color when Fan > Tolerance. The HTML block is positioned following the fields shown above. The field labeled Fan is ODE_Fan_TIR. The field labeled Tolerance is ODE_Labyrinth_Tol. Since Fan > Tolerance the background color of the Fan field should be red.
In the script shown below, a console error indicates that the calculated field value (Tol) is null. The error occurs in the following line of code " let tol = document.getElementById("InsertRecordODE_Labyrinth_Tol").value;"
How does one obtain and use a calculated value in an IF statement before the Submit button is pressed?
Link to comment
Share on other sites
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.