Repeating subform values to populate a table | Community
Skip to main content
nowackem
September 30, 2021
Solved

Repeating subform values to populate a table

  • September 30, 2021
  • 2 replies
  • 2011 views

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

 

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 Kosta_Prokopiu1

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. 🙂


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.

 

2 replies

Kosta_Prokopiu1
Adobe Employee
Adobe Employee
October 1, 2021

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

nowackem
nowackemAuthor
October 4, 2021

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?

October 5, 2021

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

nowackem
nowackemAuthor
October 5, 2021

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!

nowackem
nowackemAuthor
October 5, 2021

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. 🙂