Expand my Community achievements bar.

SOLVED

Repeating subform values to populate a table

Avatar

Level 6

I have a repeating subform that also houses a table with a repeating row using the add instance script. This may be impossible but I want to know if I can take some information from this subform and table then have those values populate another table. Because of the add instances, I cant hard code field names and just use global data. I need to make the second table populate and grow based on the information added to the expandable table and subform that its in. I have included a link to the form if anyone wants to give it a try. Hopefully seeing the form will explain this better.

https://drive.google.com/drive/folders/1S1qppvm9vsyZF8TxFwY_K_L0bp_APiUE?usp=sharing

 

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi @nowackem 

looked at your form and understand a bit more where you are heading. I do not have much time this week but I can help you with getting the data over. 

Your are doing it from 2 sides, the title is pushed from the subform, the amount is pulled in the secondary table. Both can be used. What is missing is to set the row where to fill in.

Here is what you can change:

Calculate script (JavaScrip!) form1.Page2.tblSummary.summaryRepeatingRow.summaryCostAverage::calculate

 

change to

var payrollIndex = this.parent.index
this.rawValue = xfa.resolveNode("Page1.subPayRollInfo[" + payrollIndex + "].tbleEmployeeInfo.averageRow.costAverage").rawValue;

 

and form1.Page1.subPayRollInfo.payrollTitle::change

change to:

 

var payrollIndex = this.parent.index
this.resolveNode("Page2.tblSummary.summaryRepeatingRow["+ payrollIndex + "].summaryPayrollTitle").rawValue = xfa.event.newText;

 

The index and putting the path together for xfa.resolveNode sets the correct row.

 

View solution in original post

7 Replies

Avatar

Employee

Hi @nowackem ,

I see your subforms and the repeating rows. What I did not quite get is the ominous second table. 

What should it contain? When you have more then one subform, do you have more than one "second table"?

Kosta

Avatar

Level 6

Hi @Kosta_Prokopiu1 ,

As the user fills out the subforms with repeating rows (subPayRollInfo) the second table should add rows with each subform of info with just the Payroll Title and Average Hourly Rate (for that title). We need that summary table to automatically expand a row for each Payroll Title and Avg Hourly Rate for that Payroll Title so we can see "at a glance" a list of titles and avg hourly rates in one spot. I hope that helps?

Avatar

Level 5

Hi @nowackem

 

I had a quick look at your form, I think I understand what you are trying to achieve.

 

Firstly, I noticed your Average Hourly Rate was not showing for me.
I checked the event
form1.Page1.subPayRollInfo.tbleEmployeeInfo.averageRow.costAverage::calculate
and found the following code
Avg(repeatingRow[*].hourlyRateUsed)
but the Language setting was Javascript. I changed this to FormCalc and it now displays the average.

 

The Add Payroll Information button (click event) can also add a Summary row (i.e. table tblePayrollAndRate).
I noticed that the payrollTitleSummary.tblePayrollAndRate.row is not repeating, should make it so.

 

When the Payroll Title is changed, change Summary Payroll Title as well.
The index should match.

 

When the Average Hourly Rate changes, change the Summary Avg Hourly Rate.

 

Remove Payroll Information button (click event) should also remove the Summary row.

 

M

Avatar

Level 6

Hi @MorisMonk 

Thank you! I was able to add a row to secondary summary table when the Add Payroll Info button is clicked and remove when the remove button is clicked. Now, how exactly do I get the values to go from the subform to the summary? Sorry, I need a little more guidance. I appreciate your time and assistance!

Avatar

Level 6

oh and I also updated the form at the link and provided the original excel doc that I had to rebuild the form from. Just so everyone could see what I had originally in case any other ideas are sparked.

Avatar

Correct answer by
Employee

Hi @nowackem 

looked at your form and understand a bit more where you are heading. I do not have much time this week but I can help you with getting the data over. 

Your are doing it from 2 sides, the title is pushed from the subform, the amount is pulled in the secondary table. Both can be used. What is missing is to set the row where to fill in.

Here is what you can change:

Calculate script (JavaScrip!) form1.Page2.tblSummary.summaryRepeatingRow.summaryCostAverage::calculate

 

change to

var payrollIndex = this.parent.index
this.rawValue = xfa.resolveNode("Page1.subPayRollInfo[" + payrollIndex + "].tbleEmployeeInfo.averageRow.costAverage").rawValue;

 

and form1.Page1.subPayRollInfo.payrollTitle::change

change to:

 

var payrollIndex = this.parent.index
this.resolveNode("Page2.tblSummary.summaryRepeatingRow["+ payrollIndex + "].summaryPayrollTitle").rawValue = xfa.event.newText;

 

The index and putting the path together for xfa.resolveNode sets the correct row.

 

Avatar

Level 6

This took my form across the finish line! Between you and @MorisMonk we got it done! Thank you both!