Expand my Community achievements bar.

Number of rows vary xml merge

Avatar

Level 1

I did a search on the forums and found out that you can use javascript to vary number of rows in a table with a button.  

I was hoping to define a table with variable number of rows (each row has several text fields), and let an xml merge decide how many rows there are.   I foolishly thought a flowed table would do that, but adding <row2...... etc> to my xml file still only shows one row after importing the xml file.  

If this is possible, any hints on where to find instructions, or samples perhaps?  I made a form that had only one table with 2 columns and one row, and I still could not make that work... I feel like I am missing some truly obvious step....  Or is this simply not possible based on using xml import in acrobat?

Matt

4 Replies

Avatar

Former Community Member

It is possible but the table will not grow until you merge/import the data onto the form. Can you post your forma nd data and we can have a look and see what is wrong.

Paul

Avatar

Level 1

It is nice of you to take a look.    

Attached is a pdf with table  and xml file with 2 rows.    Using Acrobat 9 Pro and running Form - Import Data, I still only see 1 row.  Not sure if this is my screwup or not, but probably missing something basic, as I have not messed with forms in a long while. 

My only thought is that I am trying to use fields, and I am making the table and then dragging in fields, which seems weird to me, like I have overlaid the field on the table, instead of mating it to the table. 

Matt

Avatar

Former Community Member

Ok I have had a look and I hope you can control your xml file. Right now you have each row identified as Row1, Row2, Row3 .....This means that each row is unique and as such you woudl have to bind each individual row separately. If each row always has the same structure then if you could have a Row node, then you coudl bind the fields in the table to the repeating elements and that is how the table woudl know to add another instance. In the dataview tab you can import a sample XML file to help you with the binding. I have modifed your sample to show you how it woudl look. I also added another row in the data to test with (made it easier to see if it was working). Notice that on the Row subform that the binding is set for $.Row[*]. This indicates that a new Row subform will be created for each Row node in the data file.

You can also make testing easier by using the pointing to your sample XML file in the Preview tab of the Form Properties (under File). When Preview is selected the PDF will be created with the data already merged into it. Note that this is for testing only. The data must be imported for the form to expand as you want.

Paul

Avatar

Level 1

Bingo, that was it.  Thanks, Paul.  I can edit the xml as needed.

Phew!