Expand my Community achievements bar.

Index count on repeated subform and table

Avatar

Level 3

Hi all -

I have a subform that contains a dynamic table.  The subform has a textfield that indicates a condition, and the table below it allows a user to add in actions.  A button allows the user to create a new instance of the subform, so the whole thing is repeated.

Subform is named EOC, table is tblRA.  I put the index code in a calculated textfield in the last colum of the row.

What code can I use to create a numbering system for an index on the table row?  If I just use "this.parent.index + 1", then when the table is repeated it starts over with "1".  Using _EOC.count + "-" + this.parent.index + 1 does not help as the count increases (of course) when the subform is repeated.  I'd like the first instance of the subform table to have a 1- in the row (so 1-1, 1-2, 1-3, etc) and in the next instance of the subform it would show 2-1, 2-2, 2-3, etc) for each row created.

Snap8.jpg

Snap9.jpg

The "Add Extent of Condition" button duplictaes the text field and table below it.

Thanks,

2 Replies

Avatar

Level 4

Hi,

    Can you please provide me the template that you are working? I can understand better and provide you fix, if possible.

Thanks

Avatar

Level 3

I figured it out.

As reference for any that also need to do this -

I have a subform inside a page.  Both are set to Flowed, Western Text.  Call the subform "EOC".  Inside EOC I have a text field where a user inputs an entry, call it "InputEOC".  Under InputEOC is a dynamic table, call it "tblOne".  tblOne has "Add" and "Delete" buttons to add and delete rows as needed.  I needed the ability to add in another instance of EOC, which includes InputEOC and tblOne.

My issue was creating a new number reference for each row that took into account a new instance of EOC.  I have a cell in tblOne that is a textfield set to calculated - read only. The code I created (calculated) was:

var pos1 = EOC.index + 1;
var pos2 = this.parent.index + 1;

pos1 + "-" + pos2 + "-EOC";

This creates a 1-1-EOC, 1-2-EOC, 1-3-EOC, etc for each row under the first instance of the subform EOC, and if another instance of EOC is added the new rows begin 2-1-EOC, 2-2-EOC, etc.

Snap8.jpg