Wondered if anyone has run into this. Basically I am trying to programatically add instances of a repeating subform. The trick is I don't want the subform visible to begin with, (min count = 0). Apparently it is not as simple as:
Which works when the min count = 1. Any ideas on how I can code to add instances to a repeating subform that starts out with a min count = 0?
Unknown whether you selected "Repeat Subform for Each Data Item" under subform Binding tab. You can check that and leave "Min Count:, Max: and Initial Count:" unchecked. Then you will not run into such problem.<br />again the syntax for add instance is:<br />"_<subformname>.addInstace(1)" //"_" (Underscore) is a reference notation not part of the subform name.<br /><br />If you still can not over come the issue I can offer help at "meetsekharv AT yahoo.com"
Sorry, I don't mean to be a pest. Here is some additional info:
I reduced my test form to the bare essentials. I have one main subform called Main that contains a sub form called Sub1. Main is defined as flowed and Sub1 is positioned with "Repeat for all data" checked (This time I left the min, max, and initial counts unchecked.
I have one button for adding and instance located in Main. The code behind the button is exactly as follows:
var oSubform = this.resolveNode("Main.Sub1");
var oNewInstance = oSubform.instanceManager.addInstance(1);
This results in an error that indicates my subform reference has no properties. When I switch to min count = 1 the button adds a new instance of the subform, (but as you may recall my objective is to not have an initial instance of the subform visible or taking up room which is why I am attempting to do this without a min count = 1).
Using an "_" in front of the sub form name as follows:
I receive an error message that reads "General Error: Operation Failed".
If this is supposed to work could it be the version of LiveCycle Designer I am using?
My appologies. I re-read your previous reply and double checked my code and realized that I had incorrectly used the _Sub1.instanceManager.addInstance(1);