4D v14.3Subtotal |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.3
Subtotal
Subtotal
Subtotal returns the subtotal for data for the current or last break level. Subtotal works only when a sorted selection is being printed with PRINT SELECTION or when printing using Print in the Design environment. The data parameter must be of type real, integer, or long integer. Assign the result of the Subtotal function to a variable placed in the Break area of the form. Warning: You must execute BREAK LEVEL and ACCUMULATE before every form report for which you want to do break processing and calculate subtotals. See discussion at the end of the description of this command. The second, optional, argument to Subtotal is used to cause page breaks during printing. If pageBreak is 0, Subtotal does not issue a page break. If pageBreak equals 1, Subtotal issues a page break for each level 1 break. If pageBreak equals 2, Subtotal issues a page break for each level 1 and level 2 break, and so on. Tip: If you execute Subtotal from within an output form displayed at the screen, an error will be generated, triggering an infinite loop of updates between the form and the error window. To get out of this loop, press Alt+Shift (Windows) or Option-Shift (Macintosh) when you click on the Abort button in the Error window (you may have to do so several times). This temporarily stops the updates for the form’s window. Select another form as the output form so the error will occur again. Go back to the Design Environment and isolate the call to Subtotal into a test Form event=On Printing Break if you use the form both for display and printing. The following example is a one-line object method in a Break area of a form (B0, the area above the B0 marker). The vSalary variable is placed in the Break area. The variable is assigned the subtotal of the Salary field for this break level. Break processing must have been activated beforehand using the BREAK LEVEL and ACCUMULATE commands. Case of For more information about designing forms with header and break areas, see the 4D Design Reference manual. In order to generate reports with breaks, break processing in form reports can be activated by calling the BREAK LEVEL and ACCUMULATE commands. You must execute both of these commands before printing a form report. The Subtotal function is still required in order to display values on a form. You must sort on at least as many levels as you need to break on. When using BREAK LEVEL and ACCUMULATE, the process to print a report is typically like this:
The Subtotal function is necessary in order to display values on a form. |
PROPERTIES
Product: 4D
HISTORY
Modified: 4D v11 SQL SEE ALSO
ACCUMULATE ARTICLE USAGE
4D Language Reference ( 4D v12.4) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||