Business information processing requires advanced calculations, including complex ranking, subtotals, moving averages, and lead/lag comparisons. These aggregation and analysis tasks are essential in creating business intelligence queries, and are accomplished by the use of window functions.



For Example


Display the subtotal values based on Account code and show the grand total end of the report.


The report has only one group (G_ACCT) and  group columns like 

     Account Code, Ro Number, ROLine #, Ro Type, Ro Date, Supplier#, Supplier Name, 

     Supplier Site, W/H, Buyer, Items, Qty, Price, Trxn Amount



Show the subtotal and grand total amount for Trxn amount column based on account code combination.



  • Divide the for –each loop with Account code column
  • Do the current group logic.
  • Display the subtotal column before closing the current group loop.
  • Display the grand total value at the end of the report.


Adding above steps logic in xml tags:



  1.      <?for-each-group:G_ACCT;./ACCOUNT_CODE?> (first F Xml tag)
  2.      <?for-each:current-group()?>(second F xml tag)
  3.       After displaying G_AMT Closing current-group for-each.
  4.       Displaying the  T_AMT (grand total amount)




This Post explained what the steps should follow for displaying subtotal and grand total based on the group column



Do drop a note by writing us at or use the comment section below to ask your questions.



Share this post
Recent Posts

Leave a Comment

Start typing and press Enter to search