These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Error Message on Simple Calculation using FormCalc

DeeperdownUK
Registered: Aug 12 2010
Posts: 8
Answered

I am very new at LiveCycle and I ma having a little difficulty on a calculaiton using FormCalc.
I have got the formula to work, but I keep getting an error message - I hoep someone can help!!

The formaula that I am using is: - ((1.4/(Mix_1/100))-1) * 10
where Mix_1 is a decimal field. The answer also needs to be a decimal feild.

As I said the formula works, and delivers the correct answer! (which suprised me), but when I test the script I get the follwing error message: -

"Script Faild (Language is formcalc; context is
xfa[0].form[0].topmostsubform[0].page1[0].MOD_Gas1[0])
script=((1.4/(Mix_1/100))-1) * 10
Error: arithmetic over/underflow"

Any ideas?
thanks
Ade

DeeperDownUK

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
An "arithmetic under/overflow" indicates the result of the calculation is too large or too small to be displayed.

You might try doing the math by hand and looking at the results of the calculation when you use the largest and smallest expected values.

You may also have a condition where you are trying to divide by zero or a null value is being treated as zero. You may need to add a control 'if' statement to prevent division by zero or a null value.

George Kaiser

DeeperdownUK
Registered: Aug 12 2010
Posts: 8
I have checked the mathematics and a large or small number is not apparant. Typicaly, Mix_1 will be anything from 21 to 100. It will never be any more or any less. The answer I would expect to be is in the format of 99.99.
I cannot see either how it could be division by Zero as there is no Zero in the equation - It may be something to do with the Nul value?
Any other suggestions please as I am a real novice at all this!!

DeeperDownUK

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
When do you get this error?

And what is the value of Mix_1 when the form form is reset ,there is no value entered into the field Mix_1, or one deletes the entry for Mix_1?

How is a null value treated?

Try:
xfa.host.messageBox(Concat("Mix_1 as a string is: ", Mix_1, "!"), "Debugging", 3)xfa.host.messageBox(Concat("Mix_1 as a number is: ", 1 * Mix_1, "!"), "Debugging", 3)script = ( (1.4 / (Mix_1/100) )-1) * 10

And observe what happens.

Null is 'nothing' and 'nothing' has a numeric value of zero.

George Kaiser

DeeperdownUK
Registered: Aug 12 2010
Posts: 8
Of course! the field Mix_1 is empty so when you open th efile, it will be zero! Didn't even think of that!
I ran the script and it says Mix_1=! and Mix_1=0
Any ideas on how to get round this?

DeeperDownUK

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
You can use an 'if...then...else...endif' statement, along with the 'HasValue()' function.
if(HasValue(Mix_1) & (Mix-1 ne 0) ) then// perform calculation only when there is non-zero value( (1.4 / (Mix_1/100) ) - 1) * 10else// clear the fieldnullendif

George Kaiser

DeeperdownUK
Registered: Aug 12 2010
Posts: 8
Can someone helpme please? I cannot create a new Forum on my topic - for some reason the web page justs sits there!
I have another topic I require help with,removing non populated fields within a form when converting to XML

I have painstakingly managed to complete a form which I must say really works well and if we can manipulate the data will save us hours of time. BUT
I have one problem.
The form has 2 sections. the first carries fields such as date, place etc, the second "sub form" contains several rows of fields, such as name etc. A row is completed per person attending an event. Each event could have 2, 3 or even up to 8 attending.
My problem is that at the moment I have 20 rows of data within the sub form. When we convert this to XML, the blank rows are also exported.
Is it possible to remove them at any point prior to exporting to XML?

Thanks


DeeperDownUK