Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

add Row

Avatar

Not applicable
Hi I need to add a sequence in my rows. At this moment I succeeded to add a row by clicking a button, but now I need to have a colon with Employee 1 for he first row and when I then add a 2nd row it has to say Employee 2 and so on.



Which code do I need?
3 Replies

Avatar

Level 10
You would have to determine which row instance you are on and then modify the text to display the correct name.



Do you have a button to remove an instance? That would make it difficult to keep the rows in sync with the numbers.



Are you able to write code?

Avatar

Not applicable
Paul,



I use a button ro remove an instance but it is not necessary.



The code I use is Javascript and it is a click-event



if(Incitant51.subFoire.all.length < 5){;

Incitant51.subFoire.instanceManager.addInstance(true);

}

Avatar

Level 10
You can use the parent.index on an object inside of the subform to determine which instance that you are on. Then you can use that in combination with the string Employee to get your desired result. If you allow for deleting instances then you will have to recalculate each row everytime someone deletes a row.