These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Report Object

ConnieC
Registered: Feb 16 2011
Posts: 8
Answered

I am trying to write a PDF report using JavaScript and am encountering problems with the form field that have a numerical or date value. Does anyone know if the Report Object will allow field values other than text?

Thank you,
Connie

My Product Information:
Acrobat Pro Extended 10.0, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
The problem may be related to the fact that formatted fields take the underlying field value and apply the formatting to the value for display. For example, a numeric value of 3.1415926535 might display as 3.14 and value of 3.14.1952 might display as 1952/03/14 in a date field. So when you go to get the field value with JavaScript, the underlying field value is returned, as opposed to the formatted value. Your code would have to format such field values to get it to display as is does on the form.
ConnieC
Registered: Feb 16 2011
Posts: 8
Thank you for responding. I receive the correct date value, and it is formatted properly; however, I do not receive a return value for any fields with numbers or percentages. Also, even though a value is not returned, it does not prevent the rest of the code from working. For instance, I have the following lines of code, the data for the "Proj#" field is a number, everything else it either text or date values, the code runs and I receive a report with all information displayed and in the correct format except for the "Proj#".

oReport.writeText(this.getField("Proj#").value);
oReport.writeText(this.getField("PrimaryPhase").value);
oReport.writeText(this.getField("EndDate1").value);

Thanks again.

Thank you,
Connie

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Accepted Answer
See if using the valueAsString property instead makes a difference:

oReport.writeText(getField("Proj#").valueAsString);
ConnieC
Registered: Feb 16 2011
Posts: 8
Perfect! Thank you very much.

Thank you,
Connie