PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/
__________________________________________________________________

Thanks Max and Tim for replying back - That worked great. 

Rakesh 


-----Original Message-----
From:   Max Wyss 
Sent:   Saturday, March 06, 2004 6:25 AM
To:     [EMAIL PROTECTED]
Cc:     Pdf Work
Subject:        Re: [PDF-Forms] Suppressing zeros from printing. 

 << File: ATT00000.txt; charset = WINDOWS-1252 >> 

The form is indeed right, assuming that you have no illegal calculations when all 
fields are empty. When you format fields, you will get this effect.

One thing you have to consider before you start making adjustments to your form is 
whether 0 is indeed a legal result. With that, I mean whether a legitimate calculation 
using filled in fields can lead to 0, and whether these numbers are intermediate 
results, which we use in further calculations. If all this is not the case, we can be 
a little bit less careful with the methods to suppress these zeroes...

Let's assume that all the mentioned things are not the case, one approach has already 
been mentioned in the list. You simply evaluate the result and if it is zero, you set 
the field value to blank.

However, this may not be correct in some cases. I don't know if it applies for you, 
but as you have done some serious analysis of the 
case, you would know. One of the main approaches for the case that you may have 
illegal results, or use the values for further calculations, is to not do the 
calculations until all the entry values (and therefore also your calculations) are 
valid. This would give the following structure:

    if (this.getField("myField").value != "" && 
this.getField("anotherField").value != "") {
    // we have all valid input
    doCalculations() ;
    } else {
    // not all valid input
    this.getField("result").value = "" ;
    }

Now, if we need the results for further calculations, but still want to suppress them, 
we also could switch to controlling the display of the fields, and use the Format 
event, which would leave the field value untouched. We might need to use the 
util.printf() method, in order to create the formatting we want, as in this case, we 
no longer can use the shortcuts to set the format of the fields.

Hope, this can help.


Max Wyss
PRODOK Engineering
Low Paper workflows, Smart documents, PDF forms
CH-8906 Bonstetten, Switzerland

Fax:  +41 1 700 20 37
   or  +1 815 425 6566
e-mail:  mailto:[EMAIL PROTECTED]
http://www.prodok.com

 

________________________________________________________________
Sent via the the WebMail system


 
                   

To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfforms.html

Reply via email to