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

  • Approved invoices can not be edited  - Approval process

    Hi Experts - I have recently raised an incident with SAP about Approval process - the complete message and support reply is as follows - but i believe we need a change in the approval process - if the approval required is only one but you have define

  • Critical Issue - 500- Internal Server Error for request in User's Inbox

    Hi, We have developed and deployed SOA composite and custom task flow (For Customized Email notifications).[30.7.1.1 Creating a Task Flow with a Router - http://docs.oracle.com/cd/E23943_01/dev.1111/e10224/bp_designtf.htm#SOASE744] When a request is

  • Insert pdf into html document

    Hi there, I would like to import or insert a pdf file (acrobat) into an html document and be able to write above and below the document. I have copied the document into MS paint and saved it as a gif file and inserted it that way...Is there any more

  • Wait_time vs seconds_in_wait vs last_Call_et in V$session

    Hi, DB : 11.2.0.1 Os : Aix 6.1 we executed the below query once got a call from client due to slowness . select sid,status,last_Call_et,event,wait_Class,wait_time,seconds_in_wait from v$session where sid=7521; SID USERNAME OSUSER PROGRAM WAIT_TIME SE

  • HttpURLConnection doesn't handle htaccess redirect

    I wrote this code to check if there is redirect and i successed but it doesn't handle htaccess redirect I know htaccess redirect == 301 but here it give me 200 WHY I want to handle htaccess redirect any help ?    URL link=null; int httpResponseCode=0