Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Dynamic page number or Reset page number & counter

Avatar

Level 1

Hi,

I am trying to reset the page number

dynamic page number
I am trying to print multiple documents in one report, the requirement is to reset page numbers for every document(to start counting from 1)
I don't have control over the size of the document because it is a flow table
I am using page conditional break to finish the document and start a new one but I couldn't change the page number or create a counter to use it as page number.

I am using ALD 8.1

all the design is in the body page the master page is empty.


Is there a way to create a counter and then assign it as page number?

OR

Is there a way to reset the page number back to 1 or 0 ?

OR

Is there a way to create a counter and reset it when using the conditional break ?

I found many solutions but none of them fit to solve this issue, because the dolutions I found were based on fixed number of pages and in my case I can't figgure out the number of pages because it is a flow table.

Sami

18 Replies

Avatar

Former Community Member

On the Mater page there is a pagination tab. This will control what number to start the page numbering at for each file in your batch process. Simply click on the Start At radio button and enter the number you want to start at. If you are stil having issues, post your form and we can have a look.

Paul

Avatar

Level 1

Thanks for you response,

My main problem is that all documents are in one batch, I tried the solution you suggested, but it is not reseting the page number.

My progress now is: I could calculate the total number of pages of each document which will show only in the first only first header of each document [by creating a field with following logic inside the table header

data.mainsub.Table.body.IT_ZCOUNT_SHEET1.DATA.TABLEHEADER1.pagenum.pagenumber = data.mainsub.Table.body.IT_ZCOUNT_SHEET1.DATA.TABLEHEADER1.pagenum.pagenumber +1;

but if I used the same logic in calculate event it show on every page but wrong values

I post both results.

Avatar

Former Community Member

Can you post the form and the data file and I will have a look and see if I can see what is wrong.

Paul

Avatar

Level 1

Paul,

Thanks for your help

I attached the form and the interface

Avatar

Former Community Member

I do not know what you attached but there is no workable form in there. Do you have an XDP or a PDF that you are using?

Paul

Avatar

Level 1

I figured it out thanks any way
If anyone looking for a solution for the same issue
he solution is as follows
create 3 numeric fields in the header of the table
total
counter 1
counter 2
the total is to count the number of pages of each document
in initialization event
total = total + 1 ;
the counter 1 is to make the counter of the pages from 0 to total (invisible)
in calculate event
if ( counter 1 < total ) then
counter 1 = counter 1 + 1 .
elseif( counter 1 >= total ) then
counter 1 = 1
counter 2 to show the page number of the document
in layout ready
counter 2 = 1
in calculate event
counter 2 = counter 1 + 1
Note: this is the logic with little modification create the code
Regards
Sam or Muneer

Avatar

Level 1

I am trying to do the same thin (or at least, it sounds like the same thing).  I tried the solution but it didn't work for me.  The Total, Counter1, and Counter2 all kept their original values (1/0) throughout the batch of documents.

Can someone please HELP?!

I have attached an example of the PDF.  Please note that there are two documents in this batch but there could be one or many more.  Each subset  needs to have it's own page # of ## and start at 1.  So instead of the entire batch in this example being page 1 of 8, it should be page 1 of 4 for each of the two documents in the batch.  Also, is there a way not to count the blank page?  I am using ALD 8.0.  the template is comprised of a master page with the label "DOCUMENT CHANGE PROPOSAL", a blank content area and a subform (page 1) which repeats depending on how many records are in the XML data it is bound to.

Thanks!

Peace and Blessings,

Nikki

Avatar

Former Community Member

Do you have a sample data file that has multiple records so we have some test material?

Avatar

Level 1

Did you see the PDF that I attached to my last post?  Is it not enough?  The data is on the classified system and it takes awhile to tranfer it to the system i'm on right now.

Peace and blessings,

Nikki

Avatar

Level 1

Did you see the PDF that I attached to my last post?  Is it not enough?  The data is on the classified system and it takes awhile to tranfer it to the system i'm on right now.

Peace and blessings,

Nikki

Avatar

Former Community Member

Its Ok I used the generate sample data in Preview .....

I found that the designer is only a single record interface. You are using features that are intended to be used with LiveCycle Output Server. Designer has no concept of the repeating record. There is no means to indicate in a design where the repeating record node is. There are parameters in teh Output server calls that allow me to indicate where the repeating record starts so it knows how to create the multi output.

Are you using this with Output server?

Paul

Avatar

Level 1

I don't even know what Output Server is.  We are using Synergy/Change which runs a report  in XML containing one or more records.  The end result is the PDF like the example containing one or more subforms corresponding to the one or more XML data records.

Peace and Blessings,

Nikki

Avatar

Level 1

I have reread your last post several times and think I may have misunderstood what you were saying (working loads of OT on the same problem will wear you out!!!).  Where is the Output server and how do you use it, please?  I really appreciate your help!

Peace and Blessings,

Nikki

Avatar

Former Community Member

The ability to deal with multiple record data sets is posible with the current Designer but you are only allowed to view one record at a time. The ouput Server is built to deal with batch mode operations where you are trying to deal with multiple record datasets and create multiple print documents (which is what I am assuming you are doing).

Paul

Avatar

Level 1

Ok.  I am going to have to look up what an Output Server is but, in the meantime, I was able to tranfer over my schema and XML data file.  Please see attached.  Thanks!

Peace and Blessings,

Nikki

Avatar

Level 1

Ok, I will have to look up what an Output Server is but, in the meantime, I have attached my schema and XML data file.   Thanks!

Peace and Blessings,

Nikki

Avatar

Level 1

I forgot to correct the XML datda file so here it is again (see attached).  Also, I was not allowed to attach the schema file so here it is:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:annotation>
  <xsd:documentation xml:lang="en">
   Adobe LiveCycle Designer Purchase Order Schema Sample
  </xsd:documentation>
</xsd:annotation>

<xsd:element name="changesynergy_report" type="SCRType"/>

<xsd:complexType name="SCRType">
  <xsd:sequence>
<xsd:element name="changesynergy_report_header" type="xsd:string"/>
<xsd:element name="changesynergy_column_report_attribute_labels"  type="reportLabel"/>
<xsd:element name="changesynergy_report_attributes"  type="reportAttr"/>
<xsd:element name="changesynergy_report_footer" type="xsd:string"/>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="reportAttr">
  <xsd:sequence>
   <xsd:element name="changesynergy_report_item" type="reportItem"/>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="reportLabel">
  <xsd:sequence>
   <xsd:element name="label" type="xsd:string"/>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="reportItem">
  <xsd:sequence>
   <xsd:element name="attribute_item" type="attrItem"/>
   <xsd:element name="changesynergy_relation_report" type="relReport"/>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="attrItem">
  <xsd:sequence>
   <xsd:element name="name" type="xsd:string"/>
   <xsd:element name="value" type="xsd:string"/>
   <xsd:element name="type" type="xsd:string"/>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="relReport">
  <xsd:sequence>
   <xsd:element name="name" type="xsd:string"/>
<xsd:element name="query_string" type="xsd:string"/>
<xsd:element name="relation" type="xsd:string"/>
   <xsd:element name="sub_report" type="subReport"/>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="subReport">
  <xsd:sequence>
   <xsd:element name="I" type="xsd:string"/>
   <xsd:element name="changesynergy_report_header" type="xsd:string"/>
<xsd:element name="changesynergy_column_report_attribute_labels" type="subReportLabel"/>

<xsd:element name="changesynergy_report_attributes">

<xsd:complexType>
  <xsd:sequence>
     <xsd:element name="changesynergy_report_item">
<xsd:complexType>
  <xsd:sequence>
   <xsd:element name="attribute_item">
<xsd:complexType>
  <xsd:sequence>
   <xsd:element name="name" type="xsd:string"/>
   <xsd:element name="value" type="xsd:string"/>
   <xsd:element name="type" type="xsd:string"/>
  </xsd:sequence>
</xsd:complexType>

</xsd:element>

  </xsd:sequence>
</xsd:complexType>

</xsd:element>

  </xsd:sequence>
</xsd:complexType>


</xsd:element>

<xsd:element name="changesynergy_report_footer" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>


<xsd:complexType name="subReportLabel">
  <xsd:sequence>
   <xsd:element name="label" type="xsd:string"/>
  </xsd:sequence>
</xsd:complexType>


</xsd:schema>

Thanks for your help!

Peace and Blessings,

Nikki

Avatar

Level 1

Hi!  I got a solution from another guy I have been talking to and thought I should post it.  This solution (below) doesn't require Output ES (also see attached). An example of the out put would be: "S1/P1, S1/P2, S1/P3, [blank page], S2/P1, S2/P2, [blank page], ..."

Thanks so much for your help, Paul!  It was greatly appreciated!

---changesynergy_report.#subform[0].DocChgProposal.Multi-Subform.Header.Pages::ready:layout - (JavaScript, client)

// The trick is to notice that every time the Header subform is rendered, it is parented to an instance of the 'Multi-Subform'

// subform and, since it's used as an overlow leader, it will be rendered on every new page generated as a result of the data.

// When rendered as an overflow leader, it will be parented to the subform which broke across pages and has 'Header' as its

// overflow leader (which means that the position, within the Form DOM hierarchy, of the 'Header.Pages' field will either be

// one or two levels removed from the 'Multi-Subform' subform).

// Since the 'Multi-Subform' subform is instantiated for each report, its index number is the section indicator and each time

// the 'Header' subform is rendered, it indicates a page. We just have to check within which instance of the 'Multi-Subform'

// subform it gets placed in order to know what section it falls into.

// Finally, a dynamically-generated integer form variable is associated with each instance of the 'Multi-Subform' subform in

// order to keep track of the current page count (i.e. the number of times the 'Header' subform has been instantiated and

// rendered within it).

// Note that using the Initialize event would not have the same result since that event occurs more than once for each

// instance due to the way the data merge algorithm works. The Layout:Ready event occurs only once the subforms have been

// rendered, which means only once per instance.

var

multiSF = null;

var

parentSF = this.parent;

while

(parentSF != xfa.form)

{

   if (parentSF.name == "Multi-Subform")

   {

      multiSF

=parentSF;

      break;

   }

   parentSF

= parentSF.parent;

}

if

(multiSF)

{

   // section number is multi-sf index + 1

   var sectionNum = multiSF.index + 1;

   // page number within section depends on existence of variable and variable's value

   var pageNum = 1;

   if (multiSF.resolveNode("pageCountVar"))

   {

      multiSF.pageCountVar.value

+= 1;

      pageNum

= multiSF.pageCountVar.value;

   }

   else

   {

      // associate pageCountVar variable to current parent instance of multi-sf subform

      var pageCountVar = xfa.form.createNode("integer", "pageCountVar");

      pageCountVar.value

= 1;

      // when we create the variable, the page count is always 1

      multiSF.variables.nodes.append(pageCountVar);

   }

   this.rawValue

= "S" + sectionNum + "/P" + pageNum;

}