Allows us to include an aggregation function in a column (report.column). Generally in the after or in the befores it is required that the system performs calculations (count, sum, max, min, avg, etc). For the the aggregation functions are used.

1 aggregate

<aggregate>
    <text /> *
</aggregate>

Remarks

According to which block or region, the aggregation function is placed, the system will determine automatically the field of cut. For example: If sum(amount) is placed in the after of a group which is the "category", the system knows that it has to accumulate the amount of the category. When ir changes the category, it will start from zero.

Example

Example of aggregation function sum.

Copy
<xsql-script name='sample_aggregate_sum'>
    <body>

<report.document>
  ....
 <detail>

 
    <column flow='true'>
        <report.block>
            <report.table name='t_detail'>
                <body>
                    <report.row>
                        <report.column width='5'>
                            <tupple type='text'>country</tupple>
                        </report.column>
                        <report.column width='5'>
                            <tupple type='text'>sales</tupple>
                        </report.column>
                    </report.row>
                </body>
            </report.table>
        </report.block>
    </column>

</detail>
<after>
  <report.block>
    <report.table style='margin-top:15px;margin-bottom:15px;'>
        <body>
            <report.row>
                <report.column start='0' width='1' style='font-family:Arial;font-size:8pt;background-color: \#DBFDD9'>
                    <static type='text'>Total</static>
                </report.column>
                <report.column start='1' width='9' style='font-family:Arial;font-size:7pt;background-color: \#DBFDD9'>
                    <tupple type='text'>nombre1</tupple>
                </report.column>
                <report.column  minimumfractiondigits='2' maximumfractiondigits='2' start='10' width='2' style='border-top-style:solid;border-top-color:black;border-top-width:1px;border-bottom-style:solid;border-bottom-color:black;border-bottom-width:2px;font-family:Arial;font-size:7pt;text-align:right;background-color: \#DBFDD9;font-weight:bold;'>
                    <aggregate type='text'>sum(salape)</aggregate>
                </report.column>
                <report.column  minimumfractiondigits='2' maximumfractiondigits='2' start='12' width='2' style='border-top-style:solid;border-top-color:black;border-top-width:1px;border-bottom-style:solid;border-bottom-color:black;border-bottom-width:2px;font-family:Arial;font-size:7pt;text-align:right;background-color: \#DBFDD9;font-weight:bold;'>
                    <aggregate type='text'>sum(salant)</aggregate>
                </report.column>
    
                <report.column  minimumfractiondigits='2' maximumfractiondigits='2' start='14' width='2' style='border-top-style:solid;border-top-color:black;border-top-width:1px;border-bottom-style:solid;border-bottom-color:black;border-bottom-width:2px;font-family:Arial;font-size:7pt;text-align:right;background-color: \#DBFDD9;font-weight:bold;'>
                    <aggregate type='text'>sum(perdeb)</aggregate>
                </report.column>
    
                <report.column  minimumfractiondigits='2' maximumfractiondigits='2' start='16' width='2' style='border-top-style:solid;border-top-color:black;border-top-width:1px;border-bottom-style:solid;border-bottom-color:black;border-bottom-width:2px;font-family:Arial;font-size:7pt;text-align:right;background-color: \#DBFDD9;font-weight:bold;'>
                    <aggregate type='text'>sum(perhab)</aggregate>
                </report.column>
                <report.column  minimumfractiondigits='2' maximumfractiondigits='2' start='18' width='2' style='border-top-style:solid;border-top-color:black;border-top-width:1px;border-bottom-style:solid;border-bottom-color:black;border-bottom-width:2px;font-family:Arial;font-size:7pt;text-align:right;background-color: \#DBFDD9;font-weight:bold;'>
                    <aggregate type='text'>sum(saldo)</aggregate>
                </report.column>
            </report.row>
        </body>
    
    </report.table>
  </report.block>
</after>
  ....
</report.document>

    </body>
</xsql-script>
Example

Example of aggregation function count.

Copy
<xsql-script name='sample_aggregate_sum'>

   <body>


<report.document>

 ....
<detail>



 

   <column flow='true'>
       <report.block>
           <report.table name='t_detail'>
               <body>
                   <report.row>
                       <report.column width='5'>
                           <tupple type='text'>country</tupple>
                       </report.column>
                       <report.column width='5'>
                           <tupple type='text'>sales</tupple>
                       </report.column>
                   </report.row>
               </body>
           </report.table>
       </report.block>
   </column>


</detail>
<after>

 <report.block>
   <report.table style='margin-top:15px;margin-bottom:15px;'>
       <body>
           <report.row>
               <report.column start='0' width='1' style='font-family:Arial;font-size:8pt;background-color: \#DBFDD9'>
                   <static type='text'>Cantidad de </static>
               </report.column>
               <report.column start='1' width='9' style='font-family:Arial;font-size:7pt;background-color: \#DBFDD9'>
                   <tupple type='text'>nombre1</tupple>
               </report.column>
               <report.column  start='10' width='2' style='border-top-style:solid;border-top-color:black;border-top-width:1px;border-bottom-style:solid;border-bottom-color:black;border-bottom-width:2px;font-family:Arial;font-size:7pt;text-align:right;background-color: \#DBFDD9;font-weight:bold;'>
                   <aggregate type='text'>count(*)</aggregate>
               </report.column>
           </report.row>
       </body>
   
   </report.table>
 </report.block>


</after>

 ....


</report.document>

   </body>


</xsql-script>