Report Grouping and Calculations

In addition, ASM allows you to do a number of transformations to the output HTML. You define a number of ``blocks'' to your reports. Anyone who has used a reporting tool (eg: Microsoft Access or Crystal) will recognise these.

For example, to group on the OwnerName field:

$GROUP_OwnerName

$HEAD

<h2>$OwnerName</h2>

$FOOT

<p>Number of owners with name '$OwnerName': {COUNT.OwnerName}</p>

ASM also offers a number of calculation instructions you may use in group $$FOOT blocks and the main $$FOOTER block. These are:

Here is an example report to show all animals currently on the shelter, with their picture, grouped by their internal location and giving totals for each.

SQL:

SELECT 

animal.ID, animal.AnimalName, animal.ShelterCode, internalLocation.LocationName

FROM animal

INNER JOIN internallocation ON 

    animal.ShelterLocation = internallocation.ID

WHERE animal.Archived = 0

HTML:

$$HEADER

HEADER$$

 

$$GROUP_ShelterLocation

$$HEAD

<h2>$LocationName</h2>

<table>

<tr><td><b>Name</b></td><td><b>Code</b></td><td>Picture</td>

$$FOOT

</table>

<p><b>Total at $LocationName: {COUNT.AnimalName}</b></p>

GROUP$$

 

$$BODY

<tr>

<td>$AnimalName</td><td>$ShelterCode</td><td><img src=''{IMAGE.$ID}'' width=''300'' height=''200'' /></td>

</tr>

BODY$$

 

$$FOOTER

FOOTER$$

http://sheltermanager.sf.net