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

Dynamic Table and inscrease the number in the columns

cindy_77
Registered: Sep 10 2008
Posts: 16

I have a table which has 3 columns: colum1 (text); colum2, and column3
 
column1- header: contact information;
column 2 - location(code in this field: this.parent.index + 1); and I set initial: 2
column 3 - location: automatically display Location 2
add button: code: _Table3.addInstance(1);
 
When I preview the form. The table is display is:
column1: text;
column2: location 1
column3: location 2
  
When I select add button the new table is display but column1: and column2: is not inscrease the number(the location number is the same). It should be
column1: location 3; column2: location 4.
 
For example: everytime I select the add button the location in the columns will be inscrease number. but my coding is not working well.
 
I need your help. I need I spent alot of time to figure out but I am not successful.
 
Thanks,
Cindy
 

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
I'm not sure I understood you.
Do you want to add columns dynamically at runtime or do you mean rows?

For adding columns check out this article
http://blogs.adobe.com/formfeed/2011/10/tables-with-variable-numbers-of-columns.php


radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

cindy_77
Registered: Sep 10 2008
Posts: 16
Do you know how to post the file in the forum?
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
The forums don't allow to attach files.
You have to use a file hoster like acrobat.com to share your form.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

cindy_77
Registered: Sep 10 2008
Posts: 16
The sample form has been published. Please see the link below:
https://acrobat.com/#d=Vnpxfd2pkrSwJWDnUSWBjA

Thanks

Cindy
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

for "Add Coloumns" use this FormCalc script
  1. Table3.HeaderRow._SCOL2.addInstance(1)
  2. Table3.Row1._SCOL2.addInstance(1)
  3. Table3.Row2._SCOL2.addInstance(1)
  4. Table3.Row3._SCOL2.addInstance(1)
  5. Table3.Row4._SCOL2.addInstance(1)
  6. Table3.Row5._SCOL2.addInstance(1)
  7. Table3.Row6._SCOL2.addInstance(1)
  8. Table3.Row7._SCOL2.addInstance(1)
  9. Table3.Row8._SCOL2.addInstance(1)
and for "Remove Columns" this
  1. var colCount = Table3.HeaderRow._SCOL2.count
  2. Table3.HeaderRow._SCOL2.removeInstance(colCount-1)
  3. Table3.Row1._SCOL2.removeInstance(colCount-1)
  4. Table3.Row2._SCOL2.removeInstance(colCount-1)
  5. Table3.Row3._SCOL2.removeInstance(colCount-1)
  6. Table3.Row4._SCOL2.removeInstance(colCount-1)
  7. Table3.Row5._SCOL2.removeInstance(colCount-1)
  8. Table3.Row6._SCOL2.removeInstance(colCount-1)
  9. Table3.Row7._SCOL2.removeInstance(colCount-1)
  10. Table3.Row8._SCOL2.removeInstance(colCount-1)

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

cindy_77
Registered: Sep 10 2008
Posts: 16
after I add code from your coding to the add buttons. The columns have added furthur to the right and it cannot wrap the columns. Maybe I set the page is incorect?

I have added a code for adding a new table. when I click the add button, the location number in not be increased in the column 2 and column 3. Look like just copy information from current table.

Is my code is wrong?

Thanks for your help.