Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Remove 2 instances in LiveCycle Designer

Avatar

Level 1

Hello All!

i have 2 tables. Table1 and Table2. Table1 has Button "Add line". On click in both tables are added lines.

Tables have the same number of rows.

Each row in the first table has a button that deletes the current line.

It is necessary that this button deletes the corresponding row in the second table.

Script (generated by action builder):

//+ GENERATED - DO NOT EDIT (ID:DBE5BAB4-5E5A-461D-A88D-88E626F6B072 CRC:3827021343)
//+ Type: Action //+ Result2: RemoveInstance("$Node3","currentindex","")
//+ Result1: RemoveInstance("$Node2","currentindex","")
//+ Node3: form1[0].Page[0].Table2[0].Data_row_table2[0]
//+ Node2: form1[0].Page[0].Table1[0].Data_row_table1[0]
//+ Node1: form1[0].Page[0].Table1[0].Data_row_table1[0].Delete[0]
//+ Condition1: Button("$Node1","click")
//+ ActionName: Delete.click

this.resolveNode('Table1._Data_row_table1').removeInstance(this.parent.index);
if (xfa.host.version < 8) {
  xfa.form.recalculate(1);
}

this.resolveNode('Table2._Data_row_table2').removeInstance(this.parent.index);
if (xfa.host.version < 8) {
  xfa.form.recalculate(1);
} //-

How i can remove 2 instances in LiveCycle Designer?

Sorry, my english is very bad.

4 Replies

Avatar

Level 10

Hi,

you can try it in this way.

try {

     this.resolveNode('Table1._Data_row_table1').removeInstance(this.parent.index);

     this.resolveNode('Table1._Data_row_table1').removeInstance(this.parent.index - 1);

    

     if (xfa.host.version < 8) {

       xfa.form.recalculate(1);

     }

} catch (e) {}


Avatar

Level 1

Hi Radzmar,

i need to delete lines from Table1 and Table2 with similar index.

If i leave one line in script this.resolveNode('Table1._Data_row_table1').removeInstance(this.parent.index); or this.resolveNode('Table2._Data_row_table2').removeInstance(this.parent.index); - it work's, but with both lines in script - not work's.

FormCalc script can delete corresponding rows from the tables, but only with defined index - 0 or 1 and etc.

This script not work:

Table1._Data_row_table1.removeInstance($.parent.index)

BR

DrTiBiBo

Avatar

Level 10

Hi,

don't use the Action Builder in this case.

It's to limited in its opportunities.

Just add a script to the remove buttons click event.

this.resolveNode('Table1._Data_row_table1').removeInstance(this.parent.index);

this.resolveNode('Table2._Data_row_table2').removeInstance(this.parent.index);     

if (xfa.host.version < 8) {       

     xfa.form.recalculate(1);

}

This script requires that both tables have the same number of rows and you're deleting the same instance of the rows at once.

Avatar

Level 1

Hi Radzmar,

thank you for support, but this script don't work.

I already found the solution:

    

form1.Page.Table1.Data_row_table1.Delete::click - (FormCalc, client)

     var row_index = $.parent.index

     Table2._Data_row_table2.removeInstance(row_index)

     Table1._Data_row_table1.removeInstance(row_index)

must first delete a row from the second table