Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Auto Numbering on a Repeat Subform

Avatar

Level 2

Hello,

Currently on my form I have four columns and each column is labled Book 1, Book 2, Book 3, and Book 4.

I have a button to create a repeat subform and on the repeated subform I would like the columns to then change to Book 5, Book 6, Book 7, Book 8.

Is there a way to make this happen? I have my subform repeating, but I do not know how to change the instance of the numbers.

Thank you in advance!

11 Replies

Avatar

Level 5

Hi,

perhaps I have a solution for a part of your problem.

You could use the following script in the calculate-event in a ceil/field of the first subform or tablerow.

this.rawValue="Book " + (this.parent.index +1);

Then increase the pdf automatically the number of the subform when you add a new one.

first subform      = 1

second subform = 2

..

Let me think about it what we can do with your columns.

Kind regards

Mandy

Avatar

Level 2

Hi Mandy,

Thank you for the reply! I did try the "this.parent.index +1". If on page one it says book 1....when i hit the button to repeat the subform...on the duplicated subform it then becomes Book 2, which is incorrect for what I need it to be. If this makes sense

Avatar

Level 5

Hi,

I know. Therefore I wrote..let me think about..

This script is perfect, when you need one number per repeated subform.

I will think about the automatically numbering of the columns.

Avatar

Level 2

Hi Mandy,

Thanks! Any help is appreciated!

Avatar

Level 5

Ok, how about with dynamic columns?

  1. you create a table with the first column (named TABLE1)
  2. contained the table in a subform (named SUBFORM_TABLE)
  3. column width is 30mm
  4. mark the first ceil in row 1 and use the following script in the calculate script: "Book  " + (this.parent.parent.parent.index +1);
  5. subform SUBFORM_TABLE width is 30mm
  6. subform "Teilformular1" width is 150mm and containes the subform SUBFORM_TABLE
  7. mark the subform and go to "object" | "binding" | activate "repeat.."
  8. you add a button with the following script: SUBFORM_TABLE.instanceManager.addInstance(true);

dynTable.jpg

dynTableResult.jpg

I hope this will be helpful,

Mandy

Avatar

Level 2

Awesome! I will try it out on my form and will let you know if I have any questions. Thanks for your help so far!

Avatar

Level 5

It would be nice if you give me some feedback.

Avatar

Level 2

Hi Mandy,

I private messaged you two days ago, did you get my email? If not, I can resend it.

Avatar

Level 5

I saw no mail  Perhaps spam?

Please resend.

Avatar

Level 2

Hi Mandy,

I resent you the message. Please let me know if you get it or not.

Thanks

Avatar

Level 2

Hello nele_sonntag,

I tried to create a form that uses your dynamic column scripts, but the form fails to generate the column additions.

Would it be possible to attach a PDF that contains your example so that I can identify where I made my mistake?

Really appreciated!