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

Removing an instance

celisna
Level 2
Level 2

Hello everyone, I can not remove an instance. Currently I have a subform with add/remove button which adds a row not only to the subform of SF1 but also adds a row to SF7 of a different Section. So my addrow script looks like the below and is applied to SECTION1.SFTABLE2.Table14.Row1.: var newRow = SECTION3.SF7.instanceManager.addInstance(1); newRow.presence = "visible"; I'm having trouble removing the newRow. Anyone can help would be great! Kr, Nancy

4 Replies
_Bruce_Robertson
Level 10
Level 10

Hi Nancy,

The command would be SECTION3.SF7.instanceManager.removeInstance(index);  where index will be the index of the row you want to remove.  newRow will have an index property so SECTION3.SF7.instanceManager.removeInstance(newRow.index) will remove the row just added.

You haven't given us enough information to know how to calculate the index.  If you delete button is under the SF7 in the form structure then you can try this code;

SF7.instanceManager.removeInstance(SF7.index);

Regards

Bruce

celisna
Level 2
Level 2

Hi Bruce, Thank you for your feedback. My heirarchy is as follows: I have 2 Master Pages and 4 Sections Section 1 is where I have the delete button, I have 5 subforms in this section and the delete button is in SFTABLE2.Table14.Row1. My coding for adding a row here is: var newRow = SECTION3.SF7.instanceManager.addInstance(1); newRow.presence = "visible"; // this is because I want to make the row visible since the field itself is hidden. The row that appears is in SECTION3.SF7. I hope this helps. Thanks! Nancy

_Bruce_Robertson
Level 10
Level 10

Hi Nancy,

What we need to know is how the delete button will work out which row it has to delete.  Did you try the "SF7.instanceManager.removeInstance(SF7.index);" code.

Happy to look at your form is you upload it to Google Docs (or somewhere) you can add a link to this thread.

Regards

Bruce

celisna
Level 2
Level 2

Hi Bruce, I unfortunately cant upload anything anywhere from work. Can I send it to your email add? Furthermore, I did try the code you gave me but it didnt work... also tried different variations but still no luck. Cheers, Nancy