Highlighted

Populating rows in a table from a data connection

Avatar

29-03-2009

Hi,



I have a pdf form that contains a table that I want to pre-populate with data from an Access 2003 database, before sending the form out to clients for them to fill in. The form is to be populated with data relevant to them, so for each client there will be different data and hence there own personalised pdf form.



In the form, the table contains one data row and a button to allow the user to add a new row and hence more data. In pre-populating the table for a client, there can be any number of rows and I would like each of the rows to be shown in the table, and for the client to still have the ability to add a new row for a new record.



In LifeCycle Designer, I've created and OLEDB Data Connection to the required Access table and I have bound each field in the table to a field in the data connection. There are also numerous text fields in the form that I want to pre-populate from Access.



When I display the form in Preview mode, all of the text fields are populated correctly but only the first record in the data connection's table is displayed in the form's table. How can I get all records in the data connections table to be displayed in the form?



After I populate the form I want to be able to save it as a new pdf and email it to the client so that he can check, and edit, the pre-populated entries, and also fill out additional fields and add new rows of data to the table if required.



When I test the pdf on a computer that does not have the Access database and the required ODBC datasource, ie. the clients computer, the form opens with an error message, correctly, stating that the ODBC datasource cannot be found. It then proceeds to open displaying the correct data in the various fields. How can I supress this error message?



I hope that I'm using the most appropriate method to achieve what I want to do.



Thanks for any help that you may be able to offer?



Cheers,



Chris

Replies

Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

30-03-2009

There is no such thing as a record set object in Acrobat/Reader. It can only deal with one record at a time. So this means that you will have to write a routine that will check for the number of records that exist, then get them one at a time and as you retrieve them add a row to the table and assign them accordingly. If you are not familiar with javascript you will struggle with this!



If your other machine does not have the data source on it then how does the data get down to the form. Are you getting the data server side, populating the form then sending it to your client?
Highlighted

Avatar

30-03-2009

Thanks for you response.



My javascript is average but I'll try and figure out how to populate multiple rows in a table, unless there happens to be a sample some where. Howevere this may not be relevant if I can not achieve the main objective.



My intentions are to populate the form server side and then send it to the client with their data in the relevant fields. There machines will not have the data source so, as I've discovered, the correct data is not there when the pdf is viewed on the other machine.



What is the best way to achieve this?



Thanks

Chris
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

31-03-2009

You can do this but you will have to mark your script to run serverside or else you will get that message that you are seeing. Note that the DSN will have to be present on the server.
Highlighted

Avatar

02-04-2009

The DSN is server side as that is where the database is, but what script are you referring to and how do you mark it to run server side?



At the moment I don't have any scripts in the pdf (relating to the data binding). I have to add the script to populate the table but I want to get the basics working correctly before I tackle that one.



I've bound each field in the Object > Binding pallette to the corresponding field in my data connection. from the front-end of my application I have a button that, when selected output's the relevant data for the selected table to a temporary table and then opens the pdf file. This temporary table is the one that is used in the pdf file for the data binding. When the pdf is opened the relevant fields are populated correctly with the data from the temporary table. I then do a 'File > Save As' to save it to a new pdf file, particular to the client.



This pdf is then sent to the client and opened on a machine that does not have the database and consequently the DSN. It is now showing the correct data and I'm not getting the error message about not finding the DSN, which is great. I don't know what I did but it is working correctly now.



The only thing that I need to do now is write the script to read the table from the data connection and write each row to the table in the pdf. At the moment I am not sure as to how to go about this. Do you have any examples. How can I read data from my data connection?



Thanks



Chris