Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 847
  • Last Modified:

acrobat defaults to 0.00 in sum field

Hi - I'm calculating a SUM from 2 fields - but acrobat is insisting on writing 0.00 as default. I don't see any way to change that behaviour, without deselecting the "sum" radio button and using custom script. Or did I miss something?acrobat issue. Is there an easy script that does both the sum command and a null command?
Maybe something that would add to this?
if(event.value == 0) event.value = "";
0
seanpowell
Asked:
seanpowell
1 Solution
 
Karl Heinz KremerCommented:
Unfortunately, there is no easy solution for this.

You want two different things:
Format the number with two decimals
Hide the output if the result is 0.

In order to combine both, you have to write a script. Open up the properties for your sum field and go to the Format tab, then select a "Custom" formatting and enter the following as the custom format script:

if (event.value == 0)
    event.value = "";
else
    event.value = parseFloat(Math.round(event.value * 100) / 100).toFixed(2);

Open in new window


The condition for the if statement tests if the value is zero, if it's not, then the "else" branch converts the numeric result of the calculation to a number with two decimals.

... and, just in case it's not clear, we are not changing how you calculate the sum, so that stays the same on the "Calculate" tab. The result of the calculation is still 0.00, but we are not displaying that value. If you would use the value of the Sum field in another calculation, the value used would be 0.00 in this case.
0
 
seanpowellAuthor Commented:
Solutions don't get much better than that. Thanks khkremer :-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now