Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

add counter in addInstance


Former Community Member

I have create a sub form with an addInstance-feature. I also added a textbox and a numeric field. The text says Journey and the mumeric field is empty, but has a script to add +1. The result in the PDF is Journey 1 as title. When I click the + button, the new sub form gets the name Journey 2.

The result is Journey 3 - Journey 2 then Journey 1 while it has to be journey 1 - journey 2 -journey 3

Can anyone help to get this in the correct order? Or is there another way to add a counter in a title?

The code I use now in FormCalc is:

Incitant7.subVoyage.subVoyage.subVoyagePers.subButtonPerson.fldPerson[*] = Sum(Incitant7.subVoyage.subVoyage.subVoyagePers.subButtonPerson.fldPerson.rawValue + 1)
4 Replies


Former Community Member
Are you trying to get unique names for each of your fields in the repeating subform?

When you add an Instance of a subform it is the subform that gets the occurance number not the field ..... so in your above example if you have 3 occurances you woud have:




That makes each occurance of fldPerson unique and by knowing the subform ocurance you know which row it belongs to.


Former Community Member

I don't realy understand what you mean!

My goal is when I click the button the form should give me the title journey1 for the first, then i fill in the fields and when I click again he would need to give me Journey 2 for the second one which would be new empty fields. Now I have Journey 1 for the new added subform which is empty and journey 2 for the subform I have filled in first.


Level 4
Hi Bjorn,

Paul is saying that how you are addressing the field is incorrect.


This is addressing an array of fields called "fldPerson" on a subform, but actually there is no array of fields. Instead there is an array of subforms so you must use:


And I have no idea if "*" will work for addressing the fields.


Former Community Member
So is journey 1 and journey 2 a caption or an actual field name?