Skip to main content
Participant
January 21, 2024
Answered

Validations based on values

  • January 21, 2024
  • 1 reply
  • 708 views

I am not all too familiar on which route to go to get the desired results.

My form consists of the following, for instance 

If my TH number is wrote as +.0015, then my tolerance needs to be within +.0014 thru +.0046,

If my THnumber is wrote as+.00125, then my tolerance needs to be within +.0009 thru +.0041 and so forth shown below.

The TH number is wrote is one text field "TH" and the tolerance given can be applied to another field, but would prefer to have hidden.  In a "Total" field I would need to have red text if number falls out of range and black text if number is within the acceptable range.  My TH number is found first to find the acceptable tolerance based on the actual total.  It would be acceptable to have the tolerance field displayed in another text field once the TH number is established, but would rather not go that route if at all possible.  Please help.

This topic has been closed for replies.
Correct answer Nesa Nurani

Here is the condition for "+.0015", you can add more 'else if' for other conditions if that works for you, you can use it as custom calculation script of a 'tolerance' field, also you can add 'else' condition at the end for when there are no condition met:

var th = Number(this.getField("TH").valueAsString);
var num = Number(event.value);
if(th === .0015){
 if(num >= .0014 && num <= .0046)
  event.target.textColor = color.black;
 else
  event.target.textColor = color.red;}

 

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
January 21, 2024

Here is the condition for "+.0015", you can add more 'else if' for other conditions if that works for you, you can use it as custom calculation script of a 'tolerance' field, also you can add 'else' condition at the end for when there are no condition met:

var th = Number(this.getField("TH").valueAsString);
var num = Number(event.value);
if(th === .0015){
 if(num >= .0014 && num <= .0046)
  event.target.textColor = color.black;
 else
  event.target.textColor = color.red;}

 

Participant
January 21, 2024

Works perfect Thank you