Expand my Community achievements bar.

SOLVED

Assistance in obtaining the value of an text field in a table in the last instance of an repeating SubForm

Avatar

Level 2

Hi There

 

I have form with an repeating SubForm named "AddCont" containing a table named "ContactT. In the table I have a text field named "ContactP" in Row1 of the Table which automatically indexes when a new SubForm is added. I need to get the get value of "ContactP" in the last instance of the SubForm.

1 Accepted Solution

Avatar

Correct answer by
Level 5

Hi @IanFlem 

 

After your existing line

this.resolveNode('Main.STFrontPage.Contact._AddCont').addInstance(this.parent.index);

 

does adding the following work for you? (my forms designer is "broken" at the moment)

this.resolveNode('Main.DATable.Accom.Table1.Row1.Guests').rawValue = Main.STFrontPage.Contact._AddCont.count;

p.s. I also noticed "calculate - (FormCalc, client)" and not "::calculate - (JavaScript, client)"

 

Cheers 

View solution in original post

6 Replies

Avatar

Level 5

Hi IanFlem

I gave this a quick try on an adaptive form, if I understood correctly can you try this ...

lastPanelIndex = AddCont.instanceManager.instanceCount - 1; // get index of last instance of panel

myTable = guideBridge.resolveNode("AddCont[" + lastPanelIndex + "].ContactT[0]");

numRows = myTable.items.length - 1; // remove 1 if header row in table

lastRowIndex = numRows - 1; // get index of last row in table

myValue = guideBridge.resolveNode("AddCont[" + lastPanelIndex + "].ContactT[0].Row1[" + lastRowIndex + "].ContactP[0]").value;

testOutput.value = myValue;

Hope it helps in some way.

Avatar

Level 2

Hi @MorisMonk

 

I tried it in the calculate and exit event it's still not working. Also its only the Subform "Add Count" that is repeating the table is a standard table with no repeating rows.

 

Thanks 

Avatar

Level 5

Hi @IanFlem 

 

I didn't quite get what you are trying to do exactly. You tried it on Calculate and Exit events of which field(s)?

"automatically indexes" - does this mean the ContactP of the new subform should contain the ContactP value of the previous subform + 1?

How do the "Add Count" subforms get added? 

 

Cheers

Avatar

Level 2

Hi @MorisMonk 

this is code in ContactP. 

form1.Main.STFrontPage.Contact.AddCont.ContactT.Row1.ContactP::calculate - (FormCalc, client)

this.rawValue = this.parent.parent.parent.instanceIndex +1;

 

I then have an add button in the same ContactT table that with this code:

this.resolveNode('Main.STFrontPage.Contact._AddCont').addInstance(this.parent.index);

 

Now I need to display the value of the last instance of AddCont.ContactT.Row1.ContactP in the following field:

Main.DATable.Accom.Table4.Row1.Guests

 

Avatar

Correct answer by
Level 5

Hi @IanFlem 

 

After your existing line

this.resolveNode('Main.STFrontPage.Contact._AddCont').addInstance(this.parent.index);

 

does adding the following work for you? (my forms designer is "broken" at the moment)

this.resolveNode('Main.DATable.Accom.Table1.Row1.Guests').rawValue = Main.STFrontPage.Contact._AddCont.count;

p.s. I also noticed "calculate - (FormCalc, client)" and not "::calculate - (JavaScript, client)"

 

Cheers 

Avatar

Level 2

@MorisMonk 

 

Thank You so much. I used your script as follows;

this.rawValue = Main.STFrontPage.Contact._AddCont.count;