6 Replies Latest reply on Nov 2, 2014 7:00 PM by philmodjunk

    Table of Contents calculation



      Table of Contents calculation


      I am trying to create a table of contents for a directory of catalog images. I'd like to have a what page of the report that the image is in.

      The report is set up with 7 columns and 6 rows of photos with a short description under each photo. The records are sorted by category, then alpha. A new page starts when the category changes, this is where I'm stuck. 


      Anyone have any ideas?

        • 1. Re: Table of Contents calculation

          You want the page number where each category starts as your table of contents?

          If there's a set number of images to each page (7 x 6 = 42) in each category, then you can calculate the number of pages for each category. (If you have sliding fields producing a variable number of images/page then this approach can't be used.)

          Define a "count of" summary field and then. Ceiling ( GetSummary ( sRecordCountFIeld ; Category ) / 42 )

          will compute the number of pages needed for each category. These page counts, (plus an "offset" for the TOC page and any others that make up the initial pages of your catalog), can be used to compute the page number of the start of each category.

          Another approach is to preview the catalog and loop through the pages, using Get ( PageNumber ) to capture the page number in a variable each time that the category changes to a new one when the page changes.


          • 2. Re: Table of Contents calculation

            Thank you for the help.

            The TOC will be a different report, it doesn't need to have a page number. All records names in the TOC will be alphabetical regardless of category. Some categories will have more than 42 and take up more than a page in the catalog, others less then 42

            I'll try your suggestions, thanks again!


            • 3. Re: Table of Contents calculation

              The first method didn't seem to work, if the pages didn't start over every time the category changed (based on 42 images per page)

              I am trying a script, but doesn't give me any results. Here is the script:

              Go to Layout [ “Product Catalog” (PROD2014) ]
              Enter Preview Mode
                  Go to Record/Request/Page [ First ]
                  Set Variable [ $GetPageNumber; Value:PROD2014::Page in Directory = Get ( PageNumber ) ]
                  Go to Record/Request/Page [ Next; Exit after last ]
              End Loop
              Go to Layout [ “Photo Import” (PROD2014) ]
              Enter Browse Mode

              Not sure what I am doing wrong, any ideas?



              • 4. Re: Table of Contents calculation

                Apparently: "A new page starts when the category changes" is not always the case. As this is a requirement for the method that counts records to calculate page numbers.

                The syntax in your set variable step is incorrect. It sets the variable to a value of 1 or 0 depending on whether the field's value equals the page numbers.

                Instead, try this script step:

                Set Variable [$PageNumberList ; value: List ( $PageNumberList ; Get ( PageNumber ) ]

                This produces a return separated list of page numbers and you can then return to browse mode and loop through the values in that variable to set up your table of contents.

                • 5. Re: Table of Contents calculation

                  Thank you Phil for the response.

                  I've never used the list function before. Where is this list of page numbers viewed or entered at? It just seems to go on forever without showing anything.


                  • 6. Re: Table of Contents calculation

                    I should have noticed the other problems in this script.

                    The Go to Record/Request/pate [first] script step is in the wrong location it needs to come before the Loop step. As written, it keeps returning to the first page each time around and thus never changes.

                    You also need to test for when the category changes and only capture the page number when there is a new category detected.

                    Enter Preview Mode []
                    Go to Record/Request/Page [First]
                       If [YourTable::Category ≠ $Category ]
                          Set Variable [$Category ; value: YourTable::Category ]
                          Set Variable [$PageNumberList ; value: List ( $PageNumberList ; Get ( PageNumber ) ) ]
                      End IF
                       Go to Record/Request/Page [Next ; Exit after last]
                    End Loop
                    Enter Browse Mode
                    #At this point you would need another loop to loop through the values of $PageNumberList in order to take the page numbers from that list and put them into the fields/records that make up your table of contents. The exact details depend on the design of your database.