Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Help with datagroups

Avatar

Former Community Member
We are trying to populate a single field on a form from the data below. We are trying to get elements from the data BooksAndRecords hierarchy. The field will include from the CustodianName datanode: BusinessNameLine1 + BusinessNameLine2 and from the CustodianForeignAddress datanode: CustodianForeignAddressLine1 + CustodianForeignAddressLine2 + City + ProviceOrState + PostalCode.<br />The problem were having is traversing within the script the subnodes under the BooksAndRecords group. How we achieve this? Can we do this via datagroup? If so, how do we syntax this?<br /><br />This is a sample of how we are connecting directly to a single node in our script.<br />this.parent.dataNode.nodes.namedItem("BusinessNameLine1");<br /><br /><Return><br /><ReturnData><br /><IRS8858><br /><BooksAndRecords><br /> <CustodianName><br /> <BusinessNameLine1>Cingular1</BusinessNameLine1><br /> <BusinessNameLine2>Cingualr2</BusinessNameLine2><br /> </CustodianName><br /> <CustodianForeignAddress><br /> <AddressLine1>CustodianForeignAddressLine1</AddressLine1><br /> <AddressLine2>CustodianForeignAddressLine2</AddressLine2><br /> <City>Berlin</City><br /> <ProviceOrState>City</ProviceOrState><br /> <Country>GY</Country><br /> <PostalCode>66K111</PostalCode><br /> </CustodianForeignAddress><br /> <ForeignLocation><br /> <AddressLine1>ForeignLocationAddressLine1</AddressLine1><br /> <AddressLine2>ForeignLocationAddressLine2</AddressLine2><br /> <City>BerlinC</City><br /> <ProvinceOrState>City2</ProvinceOrState><br /> <Country>GM</Country><br /> <PostalCode>456K99</PostalCode><br /> </ForeignLocation><br /> </BooksAndRecords>
1 Reply

Avatar

Former Community Member
I suggest that you put a large multiline field somewhere on your form and a button. On the button put this code:



MultiLineFieldName.rawValue = xfa.datasets.data.saveXML("pretty");



This will dump the datadom into that field so you can see the structure that you need to get at the nodes you want. Once you can visually see it you can use the xfa.datasets.data.node.node.....value to get the actual contents of the node that you want.



Once you get the structure you can delete the button and the field (they are simply used for debugging purposes)



Hope that helps