


I am trying to write a (java) script where the value of the field would be determined by the value of another field. For instance, if field1 is less than or equal to 50000, then 0 would be in field2,...else if field 1 is greater than or equal to 100000, then 0 would be in field 2....else field2 would be a calculated field (Field1*20/1000).
The actual script I used is:
if (RenoCost <= 50000)
{NumericField3 =="0"
}
else if (RenoCost >= 100000)
{NumericField3 == "0"
}
else
{
NumericField3 == "RenoCost*23/1000
}
Thanks
Bonny
Views
Replies
Sign in to like this content
Total Likes
You are mixing things up here
First of all, assignment of values in JS is done with a single =, not with 2. So, your NumericField3 == "0" is a logical expression, not an assignment.
Second, RenoCost and NumericField3 are objects. You must ask for the value of the object using object.rawValue.
So, what I would do is this:
In the calculate event of NumericField3
var reno = (0 + RenoCost.rawValue) // rawValue returns a string
var calcValue = 0
if ( reno > 50000 && reno < 100000 ) {
calcValue = reno * 23 / 100 ;
}
// this last line tells the event what to put in the field, it looks a bit weird, but that is the way to do it in the calculate event, the last line is just a value/variable
calcValue
Views
Replies
Sign in to like this content
Total Likes