2 Replies Latest reply on Jul 22, 2014 4:30 PM by 1060618

    Counts on "Footer"




      We have a simple Form - Header, Body and a Footer.


      1. The Body overflows based on the number of entries on a particular node in extract file (XML)

      2. The Body is built in such a way that it can overflow 10 times on a page (physical)

      3. The Footer has a "count" field, which should display the number of entries of the body on that page



      a. In the XML, there are 12 nodes - so the body overflows 10 times on page-1 and 2 times on Page-2.

      b. The count on the Footer, page-1 should display 10 and the on page-2, the count should display 2



      We are working on couple of approaches.


      a. To declare a counter variable and set it to ZERO on Header

      b. Increment this field on the Body (PreImageDAL)

      c. Set the "Count" (field on Footer Section) to the declared counter variable.


      Issue -> The Count on the footer displays the total (on all pages) instead of breaking up by page, i.e. (from the above example) - 12. I was expecting the Counter Variable to set to ZERO everytime the header overflows!


      Approach - 2

      a. Create two sections - one with the count harded as 10 and the other with a field

      b. On the Last Page set the remainder to this counter field


      Issue -> Triggering these two sections appropriately is an issue.


      I am inclined towards approach-1. Appreciate inputs on that approach or any alternate suggestions.


      Thank You.

        • 1. Re: Counts on "Footer"
          Mr Peabody-Oracle

          The reason your scenario ends up with the total count in the first footer is because all the sections trigger on the initial page and are mapped before the pagination occurs that would move overflowing sections to subsequent pages. So you did in fact count ALL the sections on page one.


          There are several ways your goal might be accomplished, but one thing you need to make sure is that you have not set your footer field to be a scope of Form or Global. You want the scope to be Section so that each occurrence of the can have a unique value.


          1. Depending upon your version (which is always helpful to include when posting a question) you may be able to do a rendition of your second approach. Beginning somewhere around version 11.5, setting a section to Copy On Overflow - as you probably have your footer - will now show additional Print Control options which include the ability to show or suppress the section depending upon whether it is the last page or Not the last page. You could simply have two footers as you suggest. Or you could define 3 footers. The primary - "full" - one that has the bulk of the content and then two small ones that are positioned in over the top of the normal footer to show this count. Using the print control, then only one or the other small sections will appear. Obviously, you do have to calculate your remainder field value for the "last page" section, but that could be done with a normal field or image rule using a DAL script. The others would simply be hard-coded to show 10, if that is your desire.


          2. Another method would be to use a PostTransDAL in the AFGJOB, placed "above" the PaginateAndPropagate rule. PandP is a post transaction rule as well that you likely already have near the bottom of your transaction rules. By placing the PostTransDAL just above that rule, you are indicating that you want that rule to run after the pagination has occurred. At that point, you will have pages as the overflow has occurred.  If you have the total count in a GVM or go get it again with a DAL CountRec rule, you can easily calculate how many pages you think you should have. Then DAL can be used to assign the appropriate value the page footers. Something like this might work:


          if (HAVEFORM("MyForm")

             #nbr = CountRec("!//Data/Details")

             #pcnt = (#nbr / 10) + 1

             #dtl = MOD(#nbr, 10)

             if (#dtl = 0)

                #pcnt -= 1

                #dtl = 10


             while (#pcnt > 0)

                 SETFLD(#dtl, "MyField", "MyFooter" & "\" & "#pcnt", "MyForm")

                 #dtl = 10




          In this case, I started the script by checking to see if the form was included. No reason to go to the work if it is not there, right?

          Next, I get the count of detail lines. If you had this value in a GVM or something, you could make a different call to pick up your value from wherever.

          Then do the math to determine the number of pages you will have, followed by calculating the remainder (Modulo).

          If the remainder is zero, that means there is an even number of items and the calculations need to be adjusted. You didn't need the +1 on the page count and you need to start your detail count at 10.

          The remainder of the logic will loop through the occurrences of the footer from last to first and assign your field value. You reset the detail count to 10 after the initial one, because all pages except the last will have 10 - by your definition.


          3. There is another way that you could accomplish this, but again it depends upon your version. There is a feature called Print-Time fields that use a naming convention to call a DAL script which can return a value for the field. If you were to use that scenario, each of the footer fields would have to calculate on demand at the point when print is occurring.  This is similar to how the page numbering fields work, except that you are calling a script to return the value at print time. I won't go into this example as either of the above probably will suffice for your needs.

          • 2. Re: Counts on "Footer"

            Dumb of me!!! Yes, Documaker (12.2) - does have options on "Print Control" where I am able to set the (variable) Footer to Last Only! This is precisely I was looking for!


            Thank you so much for taking your time and giving me much information!!! Just for kicks, I'll try your 2nd Option as well.


            Thank You.