Home Page FO Designer user guide. XSL-FO tool for Oracle APEX and the Java[TM] platform
                                                    FO Designer guide
                                                  • First steps
                                                  • Introduction
                                                  • The user interface
                                                  • Working with the interface
                                                  • Structure of the template
                                                  • Executing the template to create PDF files
                                                  • Learn by doing
                                                  • The invoice IDOC example
                                                  • The Group by example
                                                  • The two columns example
                                                  • Barcodes
                                                  • Charts
                                                  • The running totals example
                                                  • Interactive forms
                                                  • Flavours
                                                  • The base template
                                                  • Long texts and HTML fields
                                                  • The memo field explained
                                                  • Advanced functionalities
                                                  • FOP Could Server
                                                  • Migration of existing XSL-FO files
                                                  • FAQS
                                                  • Troubleshooting
                                                  • Licenses
                                                  • The running totals example

                                                    12. The running totals example explained

                                                    A very commoun requirement is to have a page footer with the subtotal of the items in the current and previous pages and a total amount at the end of the document. The running totals example located in


                                                    shows how create the subtotal item at the end of each page. The output of this example is a 2 page document, in the first page the label "Subtotal" will be generated, together with the sum of all items in the page

                                                    in the second page the text is "Total" and the value is the sum of all items in the document.

                                                    to achieve this result, two items in the detail area must be selected, one will be the LineAmount field which needs to be summed up, and the other can be any field, in this case the article field has been taken:

                                                    The LineAmount field has the property Use for Subtotal set to Yes and the subtotal type SUM will cause the values of this field to be summed up during the PDF generation.

                                                    The Article field will be used to create the "subtotal" and "total" labels. Note the subtotal type is now CONSTANT and the two constant value fields have been filled with the correct value.

                                                    To finish up the set up, the 2 fields in the page footer must reference the subtotal field in the detail section.