[TYPO3-english] TYPO3 TS userlisting: using AVG, SUM etc in select

Bert Hiddink [BENDOO e-work solutions] hiddink at bendoo.nl
Fri Dec 6 10:48:24 CET 2013


Hello,

Please have a look at the following snippet which gives me a list of 
FE-users...So far, so good...

However, at the end of the listing, I would like to render some overall 
averages, totals of some of the fields displayed...fe. the total of the 
field "tx_feuserextrafields_donation"...

Using MySQL directly, this would be something like:
SELECT type, SUM(tx_feuserextrafields_donation) FROM fe_users

But how could I integrate something like that in the snippet below in 
the "select" part? Never done something like that so I hope you can give 
me some pointers/ideas?

Thanks in advance!
Bert



lib.userlisting = CONTENT
lib.userlisting {
   stdWrap.dataWrap (
    <div class="membertitle">Participantes</div>
    <table class="membertext" id="background-image" summary="{$year}">
     <thead>
       <tr>
           <th scope="col">Donacion</th>
           <th scope="col">Nombre</th>
           <th scope="col">Apellido</th>
           <th scope="col">Pais</th>
           <th scope="col">Fecha de inscripcion</th>
         </tr>
     </thead>
     <tfoot>
       <tr>
        <td colspan="5">Participantes</td>
       </tr>
     </tfoot>
     <tbody>
   |
     </tbody>
    </table>
   )
   insertData=1
   table = fe_users
   select {
         selectFields = uid, name, tx_feuserextrafields_donation, 
first_name, country, crdate
         pidInList = {$pidParticipants}
         orderBy = name
   }
   renderObj=COA
   renderObj{

     10=TEXT
     10.field=tx_feuserextrafields_donation{$year}
     10.wrap =<td>|</td>


     15 <.10
     15.field=first_name

     20 <.10
     20.field=name

     30 <.10
     30.field=country

     40 <.10
     40.field=crdate
     40.strftime = %B %e, %Y

     wrap = <tr>|</tr>
   }
}


More information about the TYPO3-english mailing list