Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Repeat a row in a table inside a subform

Avatar

Level 3

Hello everyone!!!!!

I am trying to figure out how to repeat a row when I click a button inside a subform.  I want the row repeated and added to the table inside the subform.  How can I do this?  I also want to be able to add the numeric value of one of the cells in the generated row to a total.  I've tried the instanceManager though can't figure out how or if this is even the correct way to go at this one at this point.  Any help is greatly appreciated on this my new quest

Justin

1 Accepted Solution

Avatar

Correct answer by
Level 10

Sample is here..

https://acrobat.com/#d=NG2Sc*iKU6WmNdIiJ72aeQ

You need to check the Repeat data for each row checkbox in Row1 properties.

Save the PDF as Dynamic file..

1) Goto File menu -> Form Properties and select Defaults tab. Change the Default Render Format as Dynamic XML form

2) Select the Preview Tab. Set the Preview type as "Interactive Form" and Preview Adobe XML form as Dynamic XML form

3) Finally while saving the PDF select Save As Type as "Adobe Dynamic XML Form".

Use the below command in click event of button..

     Table1.Row1.instanceManager.addInstance(1);

Thanks

Srini

View solution in original post

9 Replies

Avatar

Correct answer by
Level 10

Sample is here..

https://acrobat.com/#d=NG2Sc*iKU6WmNdIiJ72aeQ

You need to check the Repeat data for each row checkbox in Row1 properties.

Save the PDF as Dynamic file..

1) Goto File menu -> Form Properties and select Defaults tab. Change the Default Render Format as Dynamic XML form

2) Select the Preview Tab. Set the Preview type as "Interactive Form" and Preview Adobe XML form as Dynamic XML form

3) Finally while saving the PDF select Save As Type as "Adobe Dynamic XML Form".

Use the below command in click event of button..

     Table1.Row1.instanceManager.addInstance(1);

Thanks

Srini

Avatar

Level 3

Ok so I can't upload a file so here is a link to the file I am working with:

http://www.shingleme.com/ExpenseForm4_29_10.pdf

i am trying to get the button to work but for the life of me I can't duplicate what you are doing.

Here is what I used:

foodDrinkTable.Row1.instanceManager.addInstance(1);

On the click event but nothing is happening.

Justin

Avatar

Level 3

I'm such an IDIOT!!!!!  I missed the check the repeat in row properties....LOL  Thank you for your help it works now...but I still need to know how to add a field that isn't generated yet to a total??????

Justin

Avatar

Level 10

if you want a total of a field from the repeating row, you can write the code in the Calculate event of the field..

For example if I want to display the Total of Amount from Row1 into "Food and Drink Total" Field, you need to write the code like this..

     In Calculate event of the "Food and Drink Total" Field, Language: FormCalc

     Sum(foodDrink.foodDrinkTable.Row1.amount[*])

    Where amount[*] will represent all the amount fields in the Row1.

Thanks

Srini

Avatar

Level 3

it is only adding the first row then.  How do I get it to add each row that I add??

Avatar

Level 10

Sorry mistake in the code I gave you.. In your form, Row1 is repeating so you need to put the [*] after Row1 instead of amount..

Sum(foodDrink.foodDrinkTable.Row1[*].amount)

Thanks

Srini

Avatar

Level 3

Ok so how would i delete the last row i created.  i know how to do it with a subform using removeInstance but can't figure out how to remove the last row i created???

Avatar

Level 10

The below code will remove the last added

//Make sure one row will be available all the time

if(foodDrinkTable.Row1.instanceManager.count>1)
foodDrinkTable.Row1.instanceManager.removeInstance(foodDrinkTable.Row1.instanceManager.count-1);

If you want to remove a specific Row then you need to pass the index of that Row to the removeInstance method. The index started with 0.

Thanks

Srini

Avatar

Level 3

That is PERFECT!!!!!!!!!!!!!!!!!!!!!!!!!!!!  Thank you very much for all of your help today.  I learned a TON TODAY and really appreciate all the help!!!!!!!!

Justin