Expand my Community achievements bar.

SOLVED

Generating a form from XML data - Need to take values populated in one table to create another table

Avatar

Level 2

I'm currently using ES4.  I have users entering data from another tool and I take that data in an XML format and map to an Adobe Livecycle form.

The users are entering data into a dynamic table and that is then populated onto a dynamic table in the form.  All of that works fine.  Data is correctly populated into rows and columns dynamically.

What I need to do though, is take data from that table and populate a summary on the last page of the form with contents from the earlier without prompting the users again for the information.

First table has 6 columns (let's just say A, B, C, D, E, F).  I only want rows where the value in Column A is "yes" and I only want to pull data from columns C, D, & F.

The contents of C, D & F would then populate onto a new table at the end of the form with the appropriate number of rows.

I've done quite a bit of scripting in forms, but not for dynamic tables.  I'm also not sure which event this should trigger on.  Most often I utilize the ready:form even as I'm auto generating the form from an XML.

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi, so basically once your first table is created you need to loop through its rows and for every row that meets your condition you are creating the new row in the Table B. You can do it by accessing the .instanceManager of the row in table B. Then once the row is created you can use xfa.resolveNode to pass values from table A to Table B. Your last row of the table B may be identified by the .count property that returns your current number of rows in table B.

Let me know if you'll need more details.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 2

Hi, so basically once your first table is created you need to loop through its rows and for every row that meets your condition you are creating the new row in the Table B. You can do it by accessing the .instanceManager of the row in table B. Then once the row is created you can use xfa.resolveNode to pass values from table A to Table B. Your last row of the table B may be identified by the .count property that returns your current number of rows in table B.

Let me know if you'll need more details.

Avatar

Level 2

THANK YOU SO MUCH!!!  I was successful.  The one challenge is I only needed to create a row in Table B based on specific conditions.  The instanceManager was the ticket.

Below is my sample code if anyone needs similar assistance.

var i =
Assessment.Page7.Summary.LTCSummary.TableThird.Row1.instanceManager.count

    

if
(xfa.resolveNode("Assessment.Page2.ServiceSummary.LTCSub.TableFirst.Row1["
+ this.parent.index +
"]").LTC1.rawValue == 'Yes' &&

    
xfa.resolveNode("Assessment.Page2.ServiceSummary.LTCSub.TableFirst.Row1["
+ this.parent.index +
"]").EndDate1.rawValue == null &&

    
xfa.resolveNode("Assessment.Page2.ServiceSummary.LTCSub.TableFirst.Row1["
+ this.parent.index +
"]").Agrees1.rawValue == 'Yes')

{


Assessment.Page7.Summary.LTCSummary.TableThird._Row1.addInstance(true);

xfa.resolveNode("Assessment.Page7.Summary.LTCSummary.TableThird.Row1["
+ (i - 1) + "]").ServiceType1.rawValue = this.rawValue;

xfa.resolveNode("Assessment.Page7.Summary.LTCSummary.TableThird.Row1["
+ (i - 1) + "]").Units1.rawValue =
xfa.resolveNode("Assessment.Page2.ServiceSummary.LTCSub.TableFirst.Row1["
+ this.parent.index +
"]").Units1.rawValue;

  xfa.resolveNode("Assessment.Page7.Summary.LTCSummary.TableThird.Row1["
+ (i - 1) + "]").ProviderName1.rawValue =
xfa.resolveNode("Assessment.Page2.ServiceSummary.LTCSub.TableFirst.Row1["
+ this.parent.index +
"]").ProviderName1.rawValue;


xfa.resolveNode("Assessment.Page7.Summary.LTCSummary.TableThird.Row1["
+ (i - 1) + "]").Date1.rawValue =
xfa.resolveNode("Assessment.Page2.ServiceSummary.LTCSub.TableFirst.Row1["
+ this.parent.index +
"]").Date1.rawValue;

  }