6 Replies Latest reply on Jun 7, 2016 8:48 PM by PSI

    Printing - Set Record Count Per page

    PSI

      I need to put a count of records on each page of a Bill Of Lading. There is a footer on each page that the customer has to sign so they need an accurate count per page.

      Get ( RecordNumber )  behaves differently depending upon how I display it. For Example.... In preview mode the first page shows 7 records of a BOL with 35 records.

       

      I created a calculation field:  zgRC [ Get ( RecordCount ) ; unstored ]

       

      If put zgRC on the layout in preview mode it returns 7

      When I reference it in a script it shows different values.

      {{RecordNumber}} on the layout shows 8.

      Very inconsistent results.

       

      Any ideas?

      Thanks,

      John

        • 1. Re: Printing - Set Record Count Per page
          user19752

          Which do you want, count of records in the page, or last record number in the page?

           

          You got 8 in footer as when reached at the position record 7 is already done then pointer to current record may be now in the next record.

          • 2. Re: Printing - Set Record Count Per page
            PSI

            user19752 wrote:

             

            Which do you want, count of records in the page, or last record number in the page?

             

            You got 8 in footer as when reached at the position record 7 is already done then pointer to current record may be now in the next record.

             

            What I need is to be able to calculate the Count of records for each page that prints.

             

            I find it odd that {{RecordNumber}} would show a different value than a calculation field Get ( RecordNumber )

            The calculation field is correct there are 7 records on the first page. {{RecordNumber}} is not.

             

            My plan was to use a few global fields to store the count for each page. Using the calculation field in the script it doesn't equal 7. Sometimes it's 1 sometimes it's 3.

            • 3. Re: Printing - Set Record Count Per page
              user19752

              So you need to store last record number of each page and count the difference, can't use {{RecordNumber}} direct in layout.

               

              My test got +1 value on all pages, so if I can get always the same result it is usable, but?

               

              using "hide object when" calculation in body as

              Let (

              $$recordNumbers[Get(pagenumber)] = Max ( $$recordNumbers[Get(PageNumber)] ; Get(RecordNumber) )

              ; 0 )

              • 4. Re: Printing - Set Record Count Per page
                PSI

                user19752 wrote:

                 

                So you need to store last record number of each page and count the difference, can't use {{RecordNumber}} direct in layout.

                 

                My test got +1 value on all pages, so if I can get always the same result it is usable, but?

                 

                using "hide object when" calculation in body as

                Let (

                $$recordNumbers[Get(pagenumber)] = Max ( $$recordNumbers[Get(PageNumber)] ; Get(RecordNumber) )

                ; 0 )

                Not sure I get what you mean. I tried this. I put {{RecordNumber}} in the footer. I set Hide object to your calc.

                 

                Is that what you intended?

                • 5. Re: Printing - Set Record Count Per page
                  user19752

                  Sorry I wrote the half of it since it has unresolved issue. In footer I put

                   

                  <<$$recordCount>>

                   

                  and use "hide object when" as

                   

                  Let ( [

                    $pn = Get(PageNumber)

                    ; $$recordCount = $$recordNumbers[$pn] - Case ( $pn > 1 ; $$recordNumbers[$pn - 1] )

                  ] ; 0 )

                   

                  this calculate difference of the record numbers.

                  On the 1st page this shows expected value +1. Easy for patch it, but I'm not sure if it is always 1.

                  • 6. Re: Printing - Set Record Count Per page
                    PSI

                    user19752 wrote:

                     

                    Sorry I wrote the half of it since it has unresolved issue. In footer I put

                     

                    <<$$recordCount>>

                     

                    and use "hide object when" as

                     

                    Let ( [

                    $pn = Get(PageNumber)

                    ; $$recordCount = $$recordNumbers[$pn] - Case ( $pn > 1 ; $$recordNumbers[$pn - 1] )

                    ] ; 0 )

                     

                    this calculate difference of the record numbers.

                    On the 1st page this shows expected value +1. Easy for patch it, but I'm not sure if it is always 1.

                    The above combined with the previous works.

                     

                    The only thing I needed to add was a script to clear the $$recordNumbers [x] variables.

                     

                    "{{RecordNumber}} - on the layout but off to the side in non-printing area

                    using "hide object when" calculation in body as

                    Let (

                    $$recordNumbers[Get(pagenumber)] = Max ( $$recordNumbers[Get(PageNumber)] ; Get(RecordNumber) )

                    ; 0 )"

                     

                    Thanks!!

                    John