question about displaying and counting

Hello All

I'm new to outsystems and i have some, what might seem to be basic questions. i can't show you the actual data i'm working with because it might be considered confidential.

but say i have a dataset that looks like this

I was to create a table that would end up looking something like this,

Animal       # of Animals
Dog           1
Fish           3
Cat            2

what i have so far:
SQL call to one our servers in the preperation for the page. This write to an Output Structure 'Animals'. This has a structure attribute called 'HouseAnimals'.

so now on the phyical page i have created a TableRecords, which points to SQL1.List, and i have been able to get it to list all the animals such as so using the Expression tools

Animal Type       Animal Number
Cat                   Cat1
Cat                   Cat2
Dog                  Dog1
Fish                  Fish1
Fish                  Fish2
Fish                  Fish3

Hi Nicholas,

Could you please clarify if the first data set is really as displayed?

Are you actually querying a database table that returns a single-column result like "Fish3"? What are the rules for naming this attribute? Are the results sorted somehow?

below you will find a sample query that i'm using. 

yes, i'm querying from HP Application Lifecycle Management (ALM) which holds all of it's information in a database.

this query finds all records that are found in ALM based of the animal ID such as cat3, and only looks for animals added in the past 7 days.

            FROM     {RUN} r /*Run*/                    
            WHERE     (r.RN_USER_TEMPLATE_48 LIKE 'cat%' OR
            r.RN_USER_TEMPLATE_48 LIKE 'dog%' OR
            r.RN_USER_TEMPLATE_48 LIKE 'fish%' OR
            r.RN_USER_TEMPLATE_48 LIKE 'rat%')
            AND trunc(r.RN_EXECUTION_DATE) > trunc(sysdate-7)
            ORDER BY r.RN_USER_TEMPLATE_48 asc