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.

First instance in a subform to repeat on each page

Avatar

Level 4

I have a repeating subform with a list of names.

list.JPG

I would like the first name in this subform to appear on every page.

    top of page 1

top of page.JPG

Is their a script I can place in a field on the master page to make this happen? If not is there a way to make this happen?

Thank you for any assistance.

Parre

5 Replies

Avatar

Former Community Member

Hi ParreLaws,

I believe there is no need of scripting.

Since you always wanted the first intance to repeat on every page, why don't you create a  subform in the Master Page? This subform should have a table with one row which can be binded to the first instance of the repeating section in the XML.

In this case, your hierarchy would be something like this:

<form.>

     <MasterPages>

          <Page1>

               <ContentArea>

               <Table>

Please let me know if i am not clear.

Thanks,

Avatar

Level 4

Hi alcdtrainer,

Thank you for your assistance, but can you please tell me how to bind it only to the first row? When I go under Object, Binding and use global binding and the other "name fields" in my table are the same.

Thanks again for your assistance.

Parre

Avatar

Former Community Member

Hi ParreLaws,

Considering that your XML looks something like this:

<main>

     <main1>

          <page1>

               <repeat>

                         <firstName>

                         <lastName>

                         <middleName>

               <repeat>              

                         <firstName> 

                         <lastName>

                         <middleName>

               <repeat>              

                         <firstName> 

                         <lastName>

                         <middleName>         

                 

You can add the following scirpt at the ffield level (for firsName):

this.rawValue = xfa.resolveNode("$record.main1.page1.repeat.firstName").value;

Note: 1) $record always refer to the parent node (here it is main). So, it is not requied to mention the top most parent name main in the path.

         2) Since the index is not mentioned, the above script will always take the first repeating intance values

Keep the binding as Global

     

Please let me know if there is any issue.

Thanks,

Avatar

Level 4

Hi Alcdtrainer,

I'm not very advanced in this software and I'm having a difficult time understanding the process. Where can I find the XML that shows  the tree that you outlined?  Also, where should I place the script? When I keep the binding as Global it make all the names the same.

Thanks again

Parre

Avatar

Former Community Member

Hi Parre,

1) The input data to PDF/XDP is an XML. Any XML is always represented in a parent child (tree) hierarchy. The XML that i had shared in the above post is just a sample one.

2) The script can be added in the initialize event of a field.

Suggest you to go through the basics of scripting,  a PDF that is avaialble at following path:

http://help.adobe.com/en_US/livecycle/8.2/LiveCycle_Designer_Scripting_Basics.pdf

If you are still facing an issue, pls mail me your template and XML at alcdtrainer@gmail.com

Thanks