Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

I keep getting an arithmetic over/underflow error

Avatar

Level 3

I am very new to Livecycle (I have only been using it for about a month and a half), and I have come across an issue when trying to create a calculation using FormCalc. I have a table where users input data, and I want one of the fields to run a calculation based on the previously entered values. The formula is this:

[value I want calculated]=[value1] *360/([value2]-[value3])

My understanding of the problem is that prior to user input, the values 2 and 3 are calculated as zero. I have looked around and I know that in order to avoid this problem, I have to script something along the lines of:

if(value2>0)and(value3>0)then

[value I want calculated]=[value1] *360/([value2]-[value3])endif

Unfortunately, I am not that great with scripting and this does not seem to work for me. If anyone could help me out, I would greatly appreciate it.

3 Replies

Avatar

Level 3

By the way, I am trying to attach my form but I cannot figure out how (slightly embarassing)

Avatar

Level 10

Checking for zero doesn't work you need to check for null.

isNull tests for null, 0 is false and 1 is true.

So for your example:

if (value2.isNull == 0 and value3.isNull == 0 ) then

[value I want calculated]=[value1] *360/([value2]-[value3])

endif

Avatar

Level 10

Oh and you can't upload to the forums, you need to use an online service like Acrobat.com or Dropbox or the like to host your file and then you can paste the link here.