Thanks in advance to anyone that can help out. I've read some forum posts about getting over an error on a LC Designer form for Arithmetic over/underflow that is occurring if a user has not filled out a field yet, so the calculation is trying to divide by zero. I applied some code (javascript below) that has worked for me on all fields I needed it, except for one, and I cannot figure out what I've done wrong.
I'm trying to determine a Loan to Value Ratio. I have been able to successfully calculate the field using the following FormCalc code, written on the calculate event of my field named "Asset1LVR":
Page4.TotalPropertyTable.Row2.PPROwing/Page4.TotalPropertyTable.Row2.PPRValue*100
This is fine and all, but if the user has not yet filled out the "PPRValue" field, then the arithmetic over/underflow error occurs because the value of PPRValue is null.
I have been using a script like this one below on other parts of my form where I was having the same trouble, and the code below works like a charm. For some reason I cannot get this code to work with my Loan to Value Ratio scenario. It is not producing anything in the "Asset1LVR" field at all, so appears to be doing nothing.
This what I am using, written on the calculate event of "Asset1LVR" and Language is set to Javascript:
if ( Page4.TotalPropertyTable.Row2.PPRValue >0) then
Page4.TotalPropertyTable.Row2.PPROwing / Page4.TotalPropertyTable.Row2.PPRValue * 100
endif
How come the FormCalc version works to calculate, but the JavaScript doesn't?
Any help is much appreciated, thank you.
Solved! Go to Solution.
Views
Replies
Total Likes
I managed to come across the answer in another post I missed earlier (REPOST - "Arithmetic Over / Underflow" Error). I've changed my code to what is shown below, and seems to work perfect. Hopefully someone else will find this useful.
// check for divisor having a value and not zero
if
(HasValue(Page4.TotalPropertyTable.Row2.PPRValue) and Page4.TotalPropertyTable.Row2.PPRValue <> 0) then
// perform division
Page4.TotalPropertyTable.Row2.PPROwing
/ Page4.TotalPropertyTable.Row2.PPRValue
* 100
else
// display nothing
""
endif
Views
Replies
Total Likes
I managed to come across the answer in another post I missed earlier (REPOST - "Arithmetic Over / Underflow" Error). I've changed my code to what is shown below, and seems to work perfect. Hopefully someone else will find this useful.
// check for divisor having a value and not zero
if
(HasValue(Page4.TotalPropertyTable.Row2.PPRValue) and Page4.TotalPropertyTable.Row2.PPRValue <> 0) then
// perform division
Page4.TotalPropertyTable.Row2.PPROwing
/ Page4.TotalPropertyTable.Row2.PPRValue
* 100
else
// display nothing
""
endif
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies