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

how to get data from specific documents and directory

alzentany
Registered: Sep 1 2010
Posts: 9
Answered

hello all,
 
i am trying to make a forms by using live cycle that can fill fields from specific document ( xxx.txt) and values from specific line from directory, and some fields are calculated so when you press a button the result will appear in a field.
 
i hope its clear if any i will write more.
 
thanks

My Product Information:
LiveCycle Designer, Windows
alzentany
Registered: Sep 1 2010
Posts: 9
hello again
people is it clear ? pls i need help
DaveyB
Registered: Dec 10 2010
Posts: 70
Hi Alzentany,

I'm guessing that English is not your primary language, please let us know what language you speak as there may be someone on the forums that can help you.

Reading your problem description, you want the PDF to open on the user computer, and draw data from a text file (or XML file, from looking at your other posts) in order to populate fields. I'm guessing that you want to populate a specific field as a drop-down, and based on the selection in that field, populate other fields with the necessary relevant data from the text/xml file, excluding the non-relevant data.

Would that be an accurate assessment ?

LiveCycle Designer 8.0
"Genius is one percent inspiration, ninety-nine percent perspiration." ~~ Thomas Edison
"If at first you don't succeed, get a bigger hammer." ~~ Alan Lewis
"If the conventional doesn't work, try the unconventional" ~~ DaveyB

alzentany
Registered: Sep 1 2010
Posts: 9
Thank you for your email,


My Description as following, i have a form with number of fields that will by filled, so to fill this fields i dont want to fill it manually by take the values from the original documents (cycle1.txt),so i need just click the filed and after the data will import to this fields, for example..

the following fields are in this form
a
ex
ey
ix
iy
i



where cycle1.txt is the file contains the following:

a = "65.569280571" ~km all this values are changed (coming from calculation)
ex = "0.00010217" ~
ey = "-0.0003911" ~
ix = "0.006066352" ~deg
iy = "-0.0134106" ~deg
l = "1.885440907" ~deg
so i think now its clear.

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Have you looked at the Scripting Reference under LiveCycle Designer's menu bar option?

Search for the topic "Working with data connections".

You can find help at Stefan Cameron on Forms and search for "data import" and "data connection".

George Kaiser

DaveyB
Registered: Dec 10 2010
Posts: 70
Accepted Answer
OK, now I understand what you were after. There are a few methods of approaching this, and having looked at some of your recent posts, I see you have been looking at XML formats already.

XML would be the better method for importing the data, since a well formed structure would allow the data to flow directly into the intended fields. There are several tutorials on this, so I won't reproduce them here. Look at the links George provided, they give several examples on how best to handle this.

As far as working with a raw text file is concerned, if you change the layout of the text file there is a very easy solution. Take a look at Adobe.com, Stefan's post (reply #3 to the OP) for a layout example, a description of the problem encountered and the workaround for it.If you retain the current text file structure, you would need to write a script specifically for the import of that file, to handle each value, trim it, and assign it to the relevant field. The links that George kindly pointed out will show you how to target and open the file, and then I would suggest using javascript to read it into an array. This way you can use the same function call on each array element to identify the correct field, strip out the excess characters and assign the value obtained to it's specific form field. This would be the more complex approach, and would not only be more time consuming, but would also be a nightmare for maintenance!

In the first two solutions, should a new field need to be added, it would simply be added to the form, then update the external application to generate the necessary header information for that field in the imported text file.

For ease of use, I would probably go for option #2, since I suspect that the application creating that text file is probably Excel or something similar, and while Excel is capable of outputting XML, it wouldn't be the layout that the PDF form would need for import. On the other hand, getting Excel to write out the values as a CSV is very easy to do, and you could use comma, space or colon delimited as desired. Using this method, your text file above would look something like:

a ex ey ix iy i   "65.569280571" "0.00010217" "-0.0003911" "0.006066352" "-0.0134106" "1.885440907"
Hope that helps you :)

DaveyB

LiveCycle Designer 8.0
"Genius is one percent inspiration, ninety-nine percent perspiration." ~~ Thomas Edison
"If at first you don't succeed, get a bigger hammer." ~~ Alan Lewis
"If the conventional doesn't work, try the unconventional" ~~ DaveyB

alzentany
Registered: Sep 1 2010
Posts: 9
Thank you George ,and DaveyB, for all these information. i started now and i think i will take time to reach my goal because i have to learn more about java script, also if you have some useful references for adobe java script will ne nice from you.

so wait me i am trying if something i will write and this post will still open.

thank you again.

Alzentany.


DaveyB
Registered: Dec 10 2010
Posts: 70
You are most welcome! For a javascript tutorial, I think that the best place to start would be the W3 Schools website. They have an extensive, and searchable, online tutorial and almost every exercise gives you the ability to try it out right there on the site. Best of all, it's free and available in 52 languages!I still refer to it from time to time when my aging memory fails me :)

LiveCycle Designer 8.0
"Genius is one percent inspiration, ninety-nine percent perspiration." ~~ Thomas Edison
"If at first you don't succeed, get a bigger hammer." ~~ Alan Lewis
"If the conventional doesn't work, try the unconventional" ~~ DaveyB