Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Problems with populating a form from XML with nested elements

Avatar

Former Community Member
I'm trying to populate a form from an XML document.<br /><br />Example XML:<br /><br /><library><br /> <librarian>Mrs. Smith</librarian><br /> <br /> <patron><br /> <patronId>12345</patronId><br /> <name>Art Vandalay</name><br /> <br /> <lendedBook><br /> <lendedOn>7/8/2006</lendedOn><br /> <due>8/8/2006</due><br /> <info><br /> <isbn>77-777777-777</isbn><br /> <title>Name Of The Book</title><br /> <author>Joe Schmo</author><br /> <misc><br /> <numberOfPages>300</numberOfPages><br /> <numberOfWords>205100</numberOfWords><br /> </misc><br /> </info><br /> </lendedBook><br /><br /> <lendedBook><br /> <lendedOn>7/8/2006</lendedOn><br /> <due>8/8/2006</due><br /> <info><br /> <isbn>88-888888-888</isbn><br /> <title>His Other Book</title><br /> <author>Joe Schmo</author><br /> <misc><br /> <numberOfPages>250</numberOfPages><br /> <numberOfWords>175000</numberOfWords><br /> </misc><br /> </info><br /> </lendedBook><br /><br /> </patron><br /></library><br /><br />In the form's hierarchy, under the main_form I have a subform that I want to repeat for every lended book <lendedBook>. Within that subform (subform1), I want to have two subforms.. one that only contains the <lendedOn> and <due> elements (subform2), and then one that contains the <info> elements (subform3).<br /><br />In subform1, I can make the javascript call<br /><br /> var books = xfa.record.patron.lendedBook.all<br /><br />and I get two elements back, which is confirmed by checking the length of the variable books. However, I can't seem to access all of the elements within each <lendedBook> element. In subform3, I've tried to set a textbox by using the following in the textbox's initialize field. I would expect the subform to repeat for each <lendedBook> element. However, I get the same subform for the first <lendedBook> element repeated twice. I'm using..<br /><br /> this.rawValue = xfa.record.patron.lendedBook.info.misc.numberOfPages.value<br /><br />What am I missing that's keeping me from accessing the other <lendedBook> elements?
0 Replies