Assistance in obtaining the value of an text field in a table in the last instance of an repeating SubForm | Community
Skip to main content
Level 2
August 15, 2021
Solved

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

  • August 15, 2021
  • 1 reply
  • 1559 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by MorisMonk

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

 


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 

1 reply

Level 4
August 16, 2021

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.

IanFlemAuthor
Level 2
August 17, 2021

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 

Level 4
August 17, 2021

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