[TYPO3-english] TYPO3 TS userlisting: using AVG, SUM etc in select
Bert Hiddink [BENDOO e-work solutions]
hiddink at bendoo.nl
Fri Dec 6 14:22:50 CET 2013
Hello Christian,
Now I have the snippet as shown below...
However, while the "20"-block renders correctly, the "10"-block does not
render any output.
Where did I go wrong?
Thanks again,
Bert
PS {$year} and {$pidParticipants} are constants
lib.userlisting = COA
lib.userlisting {
wrap (
<div class="membertitle">Participantes {$year}</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>
|
</table>
)
10 = CONTENT
10 {
table = fe_users
select {
selectFields = type, SUM(tx_feuserextrafields_donation{$year})
AS total_donation
pidInList = {$pidParticipants}
orderBy = tx_feuserextrafields_donation{$year}
}
renderObj=COA
renderObj {
10 = TEXT
10.field = total_donation
}
wrap = <tfoot><tr><td colspan="5">Total {$year}: | </td></tr></tfoot>
}
20 = CONTENT
20 {
table = fe_users
select {
selectFields = uid, name, tx_feuserextrafields_donation{$year},
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>
}
wrap = <tbody>|</tbody>
}
}
On 06-12-13 12:00, Christian Hennecke wrote:
> Am 06.12.13 11:47, schrieb Bert Hiddink [BENDOO e-work solutions]:
>> Hello Christian,
>>
>> Thanks for your reply...
>>
>> On 06-12-13 11:32, Christian Hennecke wrote:
>>
>>> [snip]
>>>
>>> You could make lib.userlisting a COA and add another CONTENT object with
>>>
>>> selectFields = type, SUM(tx_feuserextrafields_donation)
>>
>> OK but how should I render this part in order to show the total?
>>
>> renderObj=COA
>> renderObj{
>>
>> #Show total here of field tx_feuserextrafields_donation
>> 10=TEXT
>> 10.field=tx_feuserextrafields_donation ####?????
>> 10.wrap =<td>|</td>
>> ....
>
> Ah, sorry. You need to assign a new field name with AS:
>
> selectFields = type, SUM(tx_feuserextrafields_donation) AS total_donation
>
> and then
>
> renderObj=COA
> renderObj{
> #Show total here of field tx_feuserextrafields_donation
> 10=TEXT
> 10.field= total_donation
> 10.wrap =<td>|</td>
>
More information about the TYPO3-english
mailing list