Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Copy value from one field in subform, to another field in a different subform

Avatar

Level 1

Hi all.  I have been back and forth with enterprise support, and they are telling me what I want to do is impossible.  I find that hard to agree with, so hoping I can get some help here.  I have a document that I am creating, based off an XML.  The page consists of a header subform, a flowing table of variable name, and then a footer.  My problem comes in, that when the table flows to mutliple pages, my header subform will not repeat, even though I have it set as the overflow header.  According to Enterprise Support, this is by design.  The header will repeat on the footer page, if that is on a separate page, just not when the table flows to another page.  So, I came up with a solution to create an additional Header in my table, merge all the cells into one column, and copy my subform into that new header.  I would set that header to appear only on subsequent pages.  So, when I preview my document, it shows the static text fine, as I would expect, however the text fields are blank.  I need a way of copying the values from the original header subform, into the newly created table header subform.  The values will be different based on teh XML input, meaning that the first 3 pages will have one set of values, and the next 3 another, etc..  See sample below...

<NameValueList>

     <NameValue>

          <NameValueName>Name1<NameValueName>

          <NameValueDesc>Desc1<NameValueDesc>

           <TableValueList>

               <TableValue>

                    Blah

               </TableValue>

               <TableValue>

                    Blah 2

               </TableValue>

          </TableValueList>

     </NameValue>

     <NameValue>

          <NameValueName>Name2</NameValueName>

          <NameValueDesc>Desc2<NameValueDesc>

          <TableValueList>

               <TableValue>

                    Blah 5

               </TableValue>

               <TableValue>

                    Blah 6

               </TableValue>

          </TableValueList>

     </NameValue>

</NameValueList>

So, if I bind my original header to NameValueName, it will show on the first page which has my header, and the third page that has my footer.  But my 2nd page, that has the table flowed to it, has a blank value.  I tried to put code in the Initialize event of both text boxes, to copy from MainHeader.NameValueName to TableHeader.NameValueName, but that didn't work properly. 

Any ideas on how to do this?

2 Replies

Avatar

Former Community Member

Have you tried in the initialize event of your TableHeader.NameValueName :

$.rawValue = MainHeader.NameValueName.rawValue

When you are in your script, you can hold CTRL and click on the field (MainHeader.NameValueName), this way you will have the exact correct path.

Otherwise, i am not sure if this could help your problem, but have you tried using masterpages?

Hope this will help!

Max

Avatar

Level 1

Thank you very much for the reply.  I tried putting the copy statement in both the MainHeader and TableHeader initialize events.  There was different behavior, depending on the place I put the copy statement, however neither was correct.  If I put it in the initialize of the TableHeader, the NameValueName that appears on other page is Name1.  Even though the header shows Name2 when it hits the next nodes.  If I put it in the initialize of MainHeader, nothing is copied on the proper table header pages.

I initially had Master pages, however that really didn't work.  The master pages traversed the NameValueName nodes on it's own loop.  So, Each page displayed the next value in it's own loop, when the main subform loop is still showing data from the previous value.  I know this might be hard to understand, but I'm doing my best to explain.  THanks again for your reply, and I hope that there is another idea out there to fix this...