| **Navigation:**  [[introduction.htm|Language Reference]] > 9 -  Window and Report Attributes > Window and Report Attributes >====== AVE (set report total average) ====== | [[autosize set ole object resizing .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[bevel set 3 d effect border .htm|{{btn_next_n.gif|Next page}}]] | | || **AVE( **[ //variable// ]** )** {{blk2blue.jpg|blk2blue.jpg}} | **AVE** | Calculates the average (arithmetic mean) of the STRING controls' USE variable is printed. | | //variable// | The label of a numeric variable to receive the intermediate values calculated for the AVE. This allows you to create totals on other totals. The value in the //variable// is internally updated by the print engine, so it is only useful for use within the REPORT structure. | The **AVE** attribute (PROP:AVE) specifies printing the average (arithmetic mean) of the STRING controls' USE variable. Unless the TALLY attribute is present, the result is calculated as follows: ·An AVE field in a DETAIL structure is calculated each time the DETAIL structure containing the control PRINTs. ·An AVE field in a group FOOTER structure is calculated each time __any__ DETAIL structure in the BREAK structure containing the control PRINTs. ·An AVE field in a page FOOTER structure is calculated each time __any__ DETAIL structure in __any__ BREAK structure PRINTs. ·An AVE field in a HEADER is meaningless, since no DETAIL structures will have been printed at the time the HEADER is printed. The average is reset only if the RESET or PAGE attribute is also specified. The STRING control using this attribute would usually be placed in a group or page FOOTER. **Example:** **CustRpt REPORT,AT(1000,1000,6500,9000),THOUS** **Break1   BREAK(LocalVar),USE(?BreakOne)** **Break2    BREAK(Pre:Key1),USE(?BreakTwo)** **Detail     DETAIL,AT(0,0,6500,1000),USE(?DetailOne)** **            STRING(@N$11.2),AT(6000,1500,500,500),USE(Pre:F1)** **           END** **           FOOTER,AT(0,0,6500,1000),USE(?BreakOneGroupFoot)** **            STRING('Group Average:'),AT(5500,500)** **            STRING(@N$11.2),AT(6000,500),USE(Pre:F1),****AVE****(LocalVar),RESET(Break2)** **           END** **          END** **          FOOTER,AT(0,0,6500,1000),USE(?BreakOneGroupFoot)** **           STRING('Grand Average:'),AT(5500,500)** **           STRING(@N$11.2),AT(6000,500),USE(LocalVar),****AVE****,TALLY(?BreakTwo)** **          END** **         END** **        END**