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

LiveCycle Design

dazzy
Registered: Dec 7 2011
Posts: 4

I have a form that is in Word, it opens and convert great. However I'am trying to attach a MSSQL server database to it. I use the dataconnect it come in great I add the fields great. However when I preview cannot see data, I did once but can't any more. Also I want to be able to update the database using the form.
search the database to find record and load in form. I just need a little start on how to Open, view and update data using the PDF form.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Database access from a LiveCycle form is controlled from a script. This is a big topic all on it's own and cannot be covered in a forum post.

But to get you started, the DB is linked though the "sourceSet" model. So to navigate to the first record in a DB connection named "MyConn".

xfa.sourceSet.MyConn.first();

To goto the next record

xfa.sourceSet.MyConn.next();

you'll find all the functions in the XFA object reference. There is also an extensive set of video tutorials and examples on this topic at www.pdfscripting.com

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

dazzy
Registered: Dec 7 2011
Posts: 4
Thanks Thom, Just finish one of your video. However, when I ran the script I got a envoirment not tursted error in Acorbat Pro x, it would not run in LifeCycle 8.2 designer under the preview. I need to be able to connect using both software, acrobat Pro and LiveCycle Designer. That hint was somewhat helpful need just a little more not much more. The Trusted Error and if I can connect in Acrobat Pro X.
Thanks
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Do not run your tests in the Preview. Did you setup the DB to connect automatically? If not, then the error may be caused by the DB not being connected. Open the form in Acrobat Pro and do your testing by typing code into the console window.


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

dazzy
Registered: Dec 7 2011
Posts: 4
Thom ,
getting closer, I tried a test database as Stefan Cameron suggested. But the Acrobat Pro x console need diferent script commands. I'm using xfa.sourceSet.DataConnection.next();. However I watch a video you did but cant' find it now where in the Acrobat Pro the commands need to has a level to get to the xfa or document in the Javascript console. If I just get this to work I think I have i. Get pass the Enviroment Trust Error.

Thanks again
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
the top level sourceSet model contains a list of named DB connections. In the code you've shown above the connection is named "DataConnection". Is this the name you gave your DB connection. You can see in to the DataView tab in LC Designer.

Just type this into the console and run it

xfa.sourceSet.DataConnection

if it returns "undefined" then the name is wrong. But if it returns "[object XFAObject]", you know you are on the right track. Then try this

xfa.sourceSet.DataConnection.open();

I'm not sure about the video you mentioned. I know I have a bunch at www.pdfscripting.com. But I may have done one for this site or for a conference session, or something else. I don't remember.Sorry




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

dazzy
Registered: Dec 7 2011
Posts: 4
One more thing,
You said not to use Preview in the Livecycle, I should use Acrobat Pro. When I save the form in livecycle and run in Acrobat Pro the data connect does not work in that console I get a dataconnection error when I open the form, when I run the console in livecycle I get "[object XFAObject]" it works. Is there a different set of command to use these commands in Acrobat Pro which was in your video but can't find the video.

Here it is:
I need to design in livecycle and run in Acrobat Pro, but I get no dataconnection when I run in Acrobat Pro. Your video (which was good,by the way) seems suggest there are different commands for the console in Acrobat Pro (Javascript), can it use the XFA commands. when I set the database using the new dataconnection in livecycle it works in livecycle but in Acrobat Pro I get a Envoirment trust issue. Which is the way to go , to get it to work.

Thanks Again
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Very interesting. There are not any different commands between the preview in LC and Acrobat. It's all the same thing. The console operates in the context of the document object, so when it is used, all paths start at the document object. This is the only difference. Acrobat doesn't seem to like your DB connection. What exactly are you connecting too? What exactly is the data connection error that is displayed in the console? Where, how, and when is the "Environment Trust Issue" displayed?

Just as a test I would suggest setting the DB folder as a trusted entity in the Enhanced Security Tab on the Acrobat Preferences Dialog.


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