Expand my Community achievements bar.

SOLVED

Copying values in a repeatable subform from a dynamic table into a summary table

Avatar

Level 2

I have a repeating subform continaing various text boxes and a table where rows can be added and deleted. When the add new button is clicked to repeat the subform, I would like the information entered in the table to remain instead of a new blank one.

Is this possible? Any suggestions as to how I would go about this?

Thanks in advance for any help.

1 Accepted Solution

Avatar

Correct answer by
Level 2

THANK YOU so much for your help. That is exactly what I was trying to do.

Thank you again!!!

View solution in original post

11 Replies

Avatar

Level 10

You must get the last instance of your rows, take the field's value and insert it into the new instance...

var intCount = xfa.resolveNode("Table1.Row1").instanceManager.count;

xfa.resolveNode("Table1.Row1").instanceManager.addInstance(1);

xfa.resolveNode("Table.Row1[" + intCount.toString() + "].TextField14").rawValue = xfa.resolveNode("Table1.Row1[" + (intCount - 1).toString() + "].TextField14").rawValue ;

Avatar

Level 2

Thanks for your response.

I have a couple of questions though as I don't do this very often.

Am I correct in putting this code in the click event of the button that is adding the new subform instance or should it be somewhere else?

I am a little confused about the TextField14 reference here as this is a table row, I have more than one field? Sorry if these questions are very basic. An alternative I thought might work to have two tables where the second is always there but I'm not sure how to script adding new rows to it everytime a new instance of the subform is added.

Thanks

Avatar

Level 10

the TextField 14 is suppose to be the object that you have entered information in and that you want to keep it on the next row instead of having a blank information... TextField14 is only a name i'm using to show you how the syntax is suppose to be... it can be any name. as long as you chose the right textbox you want to work with.

If you want to add subforms, I highly recommend you to use the rows of a table to have a repeated subform, a table with 1 row, and 1 column, no header, no footer and a subform inside the row... from there you can add as many rows as you want...

The way to add instances, is using the instanceManager of a Row, from this point you can add and remove rows

And it is correct to put your code in a click event of a button, you can have it this way:

having more than 1 column and in ur first column, you put two buttons; + & - (add & remove)

with these buttons inside you first column of each row, you can decide to remove a specific row or to add a row to a specific place or at the end of the table... you get to choose

Avatar

Level 2

Yes, that is what I thought about the TextField.

I have uploaded my form to Google Drive - https://drive.google.com/file/d/0B9IQwEn8SFJXc2VkTnZsVk4yY1k/edit?usp=sharing

if you don't mind having a look.

What I need to do is have the Performance Review Goals information repeated/copied when a new subform is added or the information from that table copied to a summary table which will appear at the end of the form. I have this scenario working excep,t when I add a new subform, the new information overrides what was there from the first table.

Avatar

Level 2

Sorry, I opened the attachment and nothing was different.

Avatar

Level 10

Alright.. then what is it about?

Tell me:

Which button do you click to have your subform repeated?!? New button?

which Subform is repeated and what do you want to do exactly with the data in the subform...

I dont really get what you are trying to do, some explanation using the object's name you are trying to work with would help me to figure out what you are trying to do

Avatar

Level 2

When the user clicks the "new" button, a new instance of the subform "review" is created and all the fields in the first instance become read only. In the new instance of the "review" subform I would like to have the information that was put in the table "Performancegoals/updates" repeated in the new instance.

Alternatively to this, I would like to migrate the information in the "Performancegoals/updates" table each time the subform is repeated to the "goalsSummary" table at the end of the form.

I hope that helps and I can work with either solution though having the table information carried over to each new instance of the subform was what was originally asked for.

I do truly appreciate your help.

Avatar

Correct answer by
Level 2

THANK YOU so much for your help. That is exactly what I was trying to do.

Thank you again!!!

Avatar

Level 2

I have one more small problem. I actually needed this to also work on the next table "IDPPerformanceReview/updates" however, it is only copying one line when a new subform is added and not any additional rows that may be there.

I can't see what I'm missing.

https://drive.google.com/file/d/0B9IQwEn8SFJXdGI0YWtXT3k0cWM/edit?usp=sharing

If you don't mind looking, I would really like to know what I'm missing.