I have a dynamic form in LCD. It has a repeating subform called "empsheet", per employee. For each empsheet, there is a repeating subform within it called "xspread".
I have set it so that "empsheet" has an initial count of 1. That is what I get when I open the form.
I have set it so that "xspread" has an initial count of 1. I get anywhere between 2 to three, even though it set up exactly the same as its parent subform. Why?
Another thing I've noticed is that if I click the button I created to remove "xspread" to remove one of the excess spawned instances of it, they all get removed. The removal button is located within xspread and addresses up via parenting, so it should only delete its own xspread index value.
Now if I went on to create new xspread's, they behave correctly and all goes well, until I save it and reopen it. Then the values that were in the first xspread are duplicated, as is the entire xspread.
My understanding behind these two considerations are as follows:
The unique names is to avoid any events that add instances of anything to find two matching results, hence acting out the result (addInstance) on both. If there's more to it, please let me know.
In that case, no, all fields have unique names. Across the entire form. Even outside tiers of hierarchy.
Pathing specifically to the form would make sense also if I went to pass a script on an event that found multiple results of "xspread". Still, xspread is one isolated subform, nothing else shares that name.
Further, the problem is at the document initializing stage. Basically, the first instance of xspread doubles itself every time. So even if I start off the form with 0 instances of xspread, only to be added, it will during the filling out of the form. But after saving and sending, the opening of it initializes the first instance of it and doubles it. There is no other condition that forces xspread to double itself again.
If I add a new empsheet, the first xspread works correctly through and through. It's the empsheet.xspread that causes this problem, every time.
I'm going to try running a document initialize event that checks the count of form1.p1.empwrap.empsheet.spread.xspread, and if there's more than one, set it to 1. But it still makes no sense why this is happening.
Just to be sure, I went in and rummaged for ANY two fields that had matching names. I'm really particular about naming conventions. At some point I did a copy paste and a hidden field inadvertently got pasted in there and hid away in a subtree.
It shared a name with another field in a completely different area of the form's hierarchy, but it still made the difference. It's really sad because I knew better, making it easier for it to sneak by. Overconfidence.
So your words didn't empty on fallen heads Paul. Wait something I said there didn't make sense.