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

SOLVED

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

IanFlem
Level 2
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
MorisMonk
Correct answer by
Level 3
Level 3

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

2 Replies
MorisMonk
Level 3
Level 3

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.

IanFlem
Level 2
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 

MorisMonk
Level 3
Level 3

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

IanFlem
Level 2
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

 

MorisMonk
Correct answer by
Level 3
Level 3

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

IanFlem
Level 2
Level 2

@MorisMonk 

 

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

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