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

Need Help reading data from MS Access Database into LiveCycle ES (Ver. 8.1.2.3337.1.509884) using Adobe Reader 9

ctadobeman
Registered: Jul 20 2011
Posts: 6
Answered

This is a Code Blue, Defcon 3 request for help using Adobe Liveclcyle to read data from a MS Access Database. I have looked at this for 3 days and several tutorials, blogs ... anyone have this problem? By the way, I downloaded an example of this posted by Paul Guerette Web Demo - hoping to see if I could get his example working on my machine, then take the learning and resolve my own form that I am designing to do the samething. Here is what I have done so far.
1.) Created a DSN Connection to the MS Database (Parts.mdb)- attached below
2.) Open the form in Livecycle and verified that the DataConnection can be seen by the form... the (Test Connection) worked perfectly.
3.) Performed the PDF Preview and the form loads ups with the first record from the database... so I know the connection is there.
4.) Press the (Next) Button and get the following message form the JavaScript Debugger Console:
 
TypeError: xfa.sourceSet.DataConnection is undefined
 
Looks like to me it cannot recognize the DataConnection anymore... however the first record displayed when the form was rendered. I have tried changing the script window from 'JavaScript' to 'FormCalc' and I get basically the same message, just related to FormCalc.
This is very confusing and I am not sure what to look at next. If someone has some suggestions or encountered this before, any help would be greatly appreciated.
 
I have also tried running a different form whereas multiple records would be read from the same database into a repeating subform, but when I press the button on the form to (GET DATA) , I get the following message on the JavaScript console:
GeneralError: Operation failed
XFAObject.item:19:XFA:form1[0[:#subform[0]:Button1[0]:click
Index value is out of bounds
  
Are all of the errors caused by something I have not setup correctly, DSN, LiveCycle version?
Thank you in advance to anyone who can help!!!
 
- Craig Tate

Want2bXpert

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Accepted Answer
You haven't provided enough information to understand the issue. Just because data is displayed in the fields doesn't mean that the connection is open or valid. The data could be left over from something else.

But regardless, it's best to start small and then build. So, what is the name of your data connection?
And what is the code being run by the "Next" button?

There is an entire set of videos at www.pdfscripting.com that covers this topic in detail, including sample files.

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

ctadobeman
Registered: Jul 20 2011
Posts: 6
Thom,
Sorry for not providing enough information:
1.) The name of my DataConnection is "DataConnection" and the connection is made to a MS Access database locally on my laptop.

2.) From the DataView in the Form Designer, I dragged the fields onto the form and can see that they are bound.

3.) I then go into the "PDF Preview" and the form is displayed and the "First" record in the database is displayed in the fields on the form.

4.) I cliked a "Next Button" , that simply is to navigate to the next record... the exact code is as follows:

xfa.sourcSet.DataConnection.next();

5.) What I get at that point in the JavaScript Debugger window is:

TypeError" xfa.sourceSet.DataConnection is undefined


I am assuming since I am seeing the first record from the DB, that the connection is open and should remain open
as long as the form is displayed, so simply to navigate to the next record should be ok I guess.

Thank you so much for responding to my email. I am sure it is something very small that is causing this issue. By the way, I did go to your website pdfscripting.com and if I get the basic subscritption for $39 - Does that include the videos you are referencing?

Thank You

Craig Tate

Want2bXpert

ctadobeman
Registered: Jul 20 2011
Posts: 6
Sorry,
I pressed the "Accepted Answer" , but this issue is still open.

Want2bXpert

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
Are you aware that for this to work with Reader that the document needs to be Reader-enabled using Adobe's LiveCycle Reader Extensions ES2? Acrobat cannot apply the required usage rights to enable this.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The $39 membership is the video only option. You get access to all videos,but not the downloads.

If "DataConnection" is the name of your connection, and Acrobat is complaining that it doesn't exist, then something is very wrong. You'll need to do a little debug from the Console Window in the Debugger.

Enter and run this code, the return value is the name of your data connection as seen by Acrobat.

xfa.sourceSet.nodes.item(0).name

If a connection existed with the name "DataConnection", but it was not open, then Acrobat would throw a different kind of exception. On this basis there must be some difference in the naming, perhaps a case difference?

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

ctadobeman
Registered: Jul 20 2011
Posts: 6
Gentlemen,

Thank you both for your response. At this point, I believe that it could be something with the version of LiveCycle or not having the ES2 Reader Extensions. Thom, I took your recommendation and inserted the one line of code on the "click" event for the "Next Button" and below is the message that displayed in the JavaScript Debugger console window:

=========================== Begin ================================================
Acrobat EScript Built-in Functions Version 9.0
Acrobat Annotations / Collaboration Built-in Functions Version 9.0
Acrobat Annotations / Collaboration Built-in Wizard Functions Version 9.0
Acrobat SOAP 9.0

GeneralError: Operation failed.
XFAObject.item:2:XFA:form1[0]:#subform[0]:dbNext[0]:click
Index value is out of bounds
============================= END =================================================

Like I said in my original post...
The first record of the database is displayed and populates the fields on the form, but a beyond that, it seems as though the "DataConnection" is not recognized anymore. I will do some research on LiveCycle ES2 Reader Extension. I am assuming the ES2 Extension is not a free product from Adobe.
Any thing else that you may can think of would be greatly appreciated.

By the way.. below is the the exact code of what is entered on the "Click" event for the "Next Button"

var oDataConn = xfa.sourceSet.nodes.item(0).name;
app.alert('Data Connection Name is : ' + oDataConn);
xfa.sourceSet.DataConnection.next();



- Craig Tate



Want2bXpert

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
George is correct that if you want this to work in Reader, your dreaming. The server for applying Reader Rights for connecting to a DB is around $60k minimum. But if you use Acrobat Professional, version 7 or later, then it will work without any Rights Enabling. This is an Acrobat Pro application only.

There is nothing about the version or reader rights that could be causing this issue. The problem is with your form not the tools.

According to the error message you've shown above, this form does not contain any data connections. Just because the fields are showing the first data record doesn't mean that the connection worked when the PDF was opened, or even exists. To prove the connection exists you have to be able to access it in the XFA object model.

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

ctadobeman
Registered: Jul 20 2011
Posts: 6
Thom,

Thanks again for the info... I am assuming that the connection exists because when I am in the script window and begin typing: xfa.sourceSet.DataConnection shows up in options windows as a available selection. So, the xfa model recognizes its existence.

Is there any other possibility, such as exporting the data from the database as XML and importing it into the form?

- Craig Tate

Want2bXpert

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
It is certainly possible to import and export data as XML. There is a JavaScript function for this, xfa.host.importData(). You can even automate the action from a folder level script, or retrieve the XML from a server. See this tutorial, Loading External File Data.

But the direct connection is a cleaner option for a form that will be used locally on Acrobat Pro. It's very interesting that in LiveCycle Designer the DB connection is visible and verifiable. But it's non-existent in Acrobat. I would suggest a couple of tests.

First, do not use the preview tab to test the PDF. Open it in the stand alone Acrobat.
Second, create a test form with minimal fields. Just one text field, connected to the DB, and one Next button. Use this test form to figure things out.

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

ctadobeman
Registered: Jul 20 2011
Posts: 6
Thom,

Are you familiar with how to access the LiveCycle Administration Console so that I can install a trial certificate to allow ability to implement usage rights via LC Designer ES. I downloaded yesterday a trial certificate but can seem to get access to the Admin Console. The documentation says to access it one of these three methods:

LiveCycle Administration Console
LiveCycle Administration Console is the web-based portal for accessing a variety of configuration pages, where you set run-time properties that control the way LiveCycle ES2 operates.

The default user name and password for logging in to LiveCycle Administration Console is administrator and password. After you log in the first time, you can access User Management and change the password for the LiveCycle ES2 administrator account.

Access LiveCycle Administration Console

1.Open a web browser and enter this URL:
(JBoss) http://localhost:8080/adminui (local deployment using the default port)

(WebLogic) http://localhost:7001/adminui (local deployment using the default port)

(WebSphere) http://localhost:9080/adminui (local deployment using the default port)

Enter your user name and password and click Login.


Want2bXpert

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I don't use any of the LiveCycle Server products. But the issue is not rights enabling, If you can't get the DB connection to work on Acrobat Pro then it is never going to work in Reader. There is no point in trying to enable the form. You need to debug what you have now, in Acrobat Pro.

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