Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How to: Map fields in a Growing Table

BCinHOU
Level 3
Level 3

Hello, I created a table that successfully allows me to add/delete rows thanks to the help of:

http://forums.adobe.com/thread/456309?tstart=30

Now my question is how do I save this information out to XML?  Currently, I have my data connection configured with embeded XML to map each field on the form.  In workbench, I map the xfaForm variable to the same schema file.  I then add a step to save all the form data to XML to a file system.

If I have a growing table, how do I save all the data?  It obviously is preserved inside the form itself but I don't know how to export that now.  If I use the traditional method of mapping Row1.Field1, then as I add additional rows the value for each subsequent row, the value for Field1 is duplicated to Row2.

Can I reference the Instance Manager in some way to count the rows and then save each row?

21 Replies
open3view
Level 1
Level 1

Hi,

I have the same issue. I need to map my growing table with dataconnection's xsd file.

How can I do that?

Thanks

BCinHOU
Level 3
Level 3

Nobody knows out to save the data to XML from a growing table?

pguerett
Level 10
Level 10

You can add a button to the form to save the data from the form locally. The code would be:

xfa.host.exportData();

This will bring up a dialog and allow you to choose a filename. The default formt is xdp. If you want xml then modify the command to be:

xfa.host.exportData("", false);

Or you can use the menu option in Acroabt. Look under Forms/Manage Form Data/Export Data

Hope that helps

Paul

bernie_mac
Level 2
Level 2

I'm trying to do something similiar with Designer but I do not see the following:  Forms/Manage Form Data/Export Data.

If I use the xfa.host.exportData("", false);

then should I expect to have to write a web service to import the XML into a SQL Table.

pguerett
Level 10
Level 10

The exportData call will merely allow you to create an XML data file locally on the machine where the form is running. Are you using Reader or Acrobat?

Paul

bernie_mac
Level 2
Level 2

Our users would be using both reader and adobe pro.

The plan is to hang the PDF from the department web page with a request of the employee ID leading to the access of the PDF.  The PDF would then be populated with Employee Profile information.

The employee would then enter data on the form.  This form would have a table that would grow depending on the number of records the customer adds.

I would like to be able to create a data connection inside my PDF form which would allow me to read data from one dataset (SQL Server table1) and write a combination of the information from this dataset along with new information entered by the PDF user to (SQL Server Table 2).

I am inclined to make this a web form, however, "the powers that be", have grown a love for PDF forms and I've been asked to get this form online and to be fillable by users.

This leads me to some questions:

  1. How do you centralize the DB connection?
  2. Would I be better of trying to use a Web Service to move the data?
      • I've never worked with Web Services in this fashion and if this is the way I should go, could you point me to some good documentation or an example.
  3. Are there any other alternatives?

Thank you in advance for you input.

pguerett
Level 10
Level 10

You have three options for getting data into the form from an external source.

1. Have an external program (like a servlet or web program) interact with teh data source and get the data out. It woudl have to be formatted into an XML format and then merged onto the form. This could be handled by LiveCycle server where you coudl have a communication between the form and server. The positives with this solution is that it is centrally maintained and nothing is required (other than a PDF viewer) on the desktop. The negative - this will be an expensive solution as LiveCycle is a server based product so the scale and scope of your project will determine whether this is viable or not. This option is no diffferent than a web form.

2. Have the form communicate with the data sources directly. You can use ODBC data sources to communicate with one or many DBs. This is the most practical solution but it has draw backs. You must configure an ODBC data source on each machine that will contact the DB. It is for windows only and the machines must all be on the same network as the DB server. The form will also have to be Reader Extended to allow your Reader users to use ODBC connections (Acrobat users can access the DB by default). It might be cheaper to give everyone Acrobat than buying Reader Extensions server.

3. Have the form communicate with the data source through a web service program. This is the one I recommend. It has the advantage to not having any additional configuration on the client machines (all config is contained in the form). It can be run from any Reader or Acrobat platform (although the Reader users will have to have a Reader Extended form). A number fo databases expose their queries as web services already. If your DB does not do that then you will have to create an intermeadiary program  to do this. The form will send the query to the web service and it in turn will make a query to the DB. The results will run back through the web service and get returned to the form.

Hope this makes sense....

Paul

BCinHOU
Level 3
Level 3

I do have Livecycle ES.  I don't see how in LiveCycle I can identify the added rows so I can address them.  I assume I need to count the # of rows.

Requiring the user to hit a button to dump an XML out to a local file system isn't feasible.  I already have a web service to import the XML into a SQL db that gets saved in my workflow.  However, I do not know how to add the data inside the growing table into the XML.  I might be in the wrong forum but it's kinda a grey area.

bernie_mac
Level 2
Level 2

Is it possible to invoke the web service when you add a new row?

In other words, could you capture the data in the row and write to the db before moving to the next row?

pguerett
Level 10
Level 10

Yes but that would be very inefficient.

Paul

pguerett
Level 10
Level 10

Ok now I am confused ...are you trying to identify the added rows from the server side when the user submits?

Paul

BCinHOU
Level 3
Level 3

Yes.  The workflow needs to identify the new rows and dump that info into the XML.  In order to do that (without growing tables), all fields are mapped to an embedded XML schema data connection, right?  I have no idea how to map the fields to the data connection and/or how the workflow can find this info so that the server can include this data into the XML that's already being saved.

pguerett
Level 10
Level 10

You would have to compare the existing XML to the new one to see how many rows were added. Or you could have a hidden field on the form that woudl have the number of new rows ....then you coudl get that value when you submit.

Paul

bernie_mac
Level 2
Level 2

Would this be possible to do without WorkFlow?

BCinHOU
Level 3
Level 3

So I'm thinking now this solution isn't useful for me because I use an external web service to insert the XML data into a db.  The XML needs to be formatted with known fields which would be impossible if the table can grow.  Each field needs to matchup with the fields in the db for this to work.

I think the only plausible solution for me would be a table with hidden fields.  Since these fields pre-exist, I can map them to my XML schema.

So I have a new question.  Can I "unhide" these fields with a +/- button on the form.  So it looks like a growing table to the end-user but in reality they are only exposing the hidden fields.

bernie_mac
Level 2
Level 2

BCinHou I am trying to add rows to a table by allowing the user to +/- a row when all required fields are populated.

I haven't put the logic into the event on the button, but I plan to capture that row of data as a record and give it a unique identifier.  I assume there is a method of reading the next record until there are no more records.

I've never worked with Web Services and I hope you could share with me what you have done.  I have a SQL Server database with two tables I'll read/write data.  So when the user hits the submit button the page would be directed to a web service (.asp page) that performs my SQL and then to a thank you page.

pguerett
Level 10
Level 10

Yes but you would need to write a web program to handle the DB (basically do the work that the Workflow does).

Paul

BCinHOU
Level 3
Level 3

Your question about how to read the next record is exactly my original question.  How do I get the data from each row in the table?  Secondly, how to I save that information into an XML from LiveCycle server?

Unfortunately, you and I have different setups in that you are working directly with the form whereas I am working from the server.  So our solutions will be different.

The web service I call is done from the server.  I don't think that is applicable in your situation, if I'm understanding you correctly.

bernie_mac
Level 2
Level 2

I think I'm going to hit a wall also when it comes time for the Web Service (.asp page) to read through the records on the PDF form.

My head is spinning.

pguerett
Level 10
Level 10

Yes but the objects will take up space while they are invisible ....you can try hidden but I am not sure how that will work inside of a table.

Paul