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

Export numerical data in dataset to csv

CAT1
Registered: Mar 18 2010
Posts: 7

I am new and self-taught on using forms so I hope someone can help me out...

I created a form using Livecycle 8.0 that requires the user to input a number that is preceded with two zeros. When I add the form to the dataset, the preceding zeros do display, but when I export to csv the zeros are dropped. I need to have the zeros in the field. How can I get the numbers to export with the preceding zeros? (Changing the csv file field to text after export doesn't work).

Thank you!!!

My Product Information:
Acrobat Pro 8.1.6, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Is the field a text field? If it is Acrobat should not be converting the value to a number. What about exporting to other data formats, such as XML?

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

CAT1
Registered: Mar 18 2010
Posts: 7
Yes, it is a text field in the form. I am using csv so that I can then populate an excel template for upload into another database. I don't use xml for a simple reason - don't know how to.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You can in fact use XML to populate a excel table. But I was more interested in how Acrobat was exporting the data. Thought there might be a clue in whether CSV and XML files exported differently.

But obviously Acrobat is converting the field value into a number at some point in the export process. One thing you can check is how the data is represented in the XFA data model. Check this from the console window by using JavaScript to drill down to this field from "xfa.data..." The question is, is the data converted when it's moved from the form into the data model, or when it's moved from the data model into the CSV file.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Ok, I just gave this a try. The data is exported properly as a string to the csv file, with the leading zeros. Excel is deciding to remove the leading zeros when it displays the data.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

CAT1
Registered: Mar 18 2010
Posts: 7
Thank you Thom, I appreciate your assistance with this more than you know! So, if the data is being exported properly, how do I get the zeros to display? I thought changing to a text field in the csv file would do it, but it doesn't. I won't be able to do my mass upload of data without those preceding zeros. Ugh!
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I tried the same thing as you, setting up the template column as text, and it still treated the incoming data as a number. The only thing I can thing of is to add a non-numeric character to the string. Punctuation, or a leadding or trialing letter.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script