How do I have Adobe Acrobat 9.0 calculate the minimum of 10 fields BUT ignore empty fields?

How do I have Adobe Acrobat 9.0 calculate the minimum of 10 fields BUT ignore the field if it is empty? Currently it counts blanks as 0 so when it comes up with the minimum it will always show 0 unless all 10 fields have values in them.

You could loop through the fields and add the non-blank values to an array, and use the Math.min method to get the minimum. Here's an example custom Calculate script:
// Custom calculate script
(function () {
    // Array to hold non-blank field values
    var fa = [];
    // Loop through the fields...
    for (var i = 1; i < 11; i += 1) {
        // ...get the current field value, as string...
        var v = getField("text1." + i).valueAsString;
        // ...if not blank, add value to the array, as a number
        if (v) fa.push(+v);
    // Set this field's value to the minimum value in the array, otherwise blank
    event.value = fa.length > 0 ? Math.min.apply(null, fa) : "";
This assumes the fields are named "text1.1", "text1.2", ..."text1.10" and that they're numeric. This type of field naming simplifies the code, so it would be good to use something similar and adjust the getField statement to match.

Similar Messages

Maybe you are looking for

  • Linking to related content from WA document

    Is there anyway create a related-content link to an FR document from within a WA dashboard, without having the link placed within a grid cell? I would ideally like to use a button, but the "Open Document" services button only allows me to link to ano

  • "The procedure entry point xmlTextReaderName could not be located in the dynamic link library libxml2.dll" fix?

    I have been unable to access the iTunes store for about 3 months and every time I turn on my computer it gives me an error that says "The procedure entry point xmlTextReaderName could not be located in the dynamic link library libxml2.dll" I have tri

  • Where are bg color / bg image in CS 5.5?

    Where are bg color / bg image in CS 5.5? They don't appear in the properties panel when a table is selected. Thanks.

  • XML/PLSQL installation problems

    Hi, I have problems with the XML Parser for PLSQL. When I try to load the jar files "xmlparserv2.jar" and "xmlplsql.jar" I have the follow error: ORA-29521 referenced name oracle/xml/* could not be found and the JDK 1.1.8 has already been installed.

  • You do not have enough access privilages.

    Here's the deal. I downloaded an app where I can download ringtones, textones, etc. and make my own. I download some text tones and ringtones that I like and when I try to add them to iTunes I get a message saying "You do not have enough access privi