App: manual - Page: fragments/grouping_2
PHP
|
HTML
fragments/grouping_2.pad
|
Result
|
|
{data 'orders'} [ {"customer":"Ann","number":101,"total":40}, {"customer":"Bob","number":102,"total":15}, {"customer":"Ann","number":103,"total":25}, {"customer":"Cleo","number":104,"total":60}, {"customer":"Bob","number":105,"total":35} ] {/data}
<table> <tr><th>Customer</th><th>Orders</th><th>Total</th><th>Average</th><th>Smallest</th><th>Largest</th></tr> {orders group='customer', sum='total', avg='total', min='total', max='total', sort='total DESC'} <tr> <td>{$customer}</td><td>{$count}</td><td>{$total}</td> <td>{$avg_total}</td><td>{$min_total}</td><td>{$max_total}</td> </tr> {/orders} </table>
|
|
App: regression/framework - Page: options/group_offers_avg_min_and_max_under_their_own_names
PHP
options/group_offers_avg_min_and_max_under_their_own_names.php
|
HTML
options/group_offers_avg_min_and_max_under_their_own_names.pad
|
Result
|
<?php
$orders = [ [ "number" => 1, "customer" => "bob", "total" => "10.10" ], [ "number" => 2, "customer" => "alice", "total" => 20 ], [ "number" => 3, "customer" => "bob", "total" => "20.20" ], [ "number" => 4, "customer" => "alice", "total" => 7 ], [ "number" => 5, "customer" => "carol", "total" => 1 ] ];
?>
|
{orders group='customer', avg='total', sum='total', min='total', max='total, number'}[{$customer} {$total} {$sum_total} {$avg_total} {$min_total} {$max_total} {$number}]{/orders}
|
|
|