Listing records in groups with a count.
Listing records in groups with a count.
Hi all,
Say I have a table called Cars with the fields Year, Make & Model. How do I count the number of records when listing the Year field in groups? The script below gives me the year in groups but say there are 25 records with the year 2020, 15 records with the year 2021, 10 records with the year 2022 and so on. Is there a way to add another field in the script that counts the number of records after listing the Year field in groups?
for Cars;
list records
Year in groups.
Re:Listing records in groups with a count.
for cars
;
list records
year in group with group totals ;
cars : Count .
Check script as done from memory :-)
Re:Re:Listing records in groups with a count.
Thank you very much for your help. If I use the following script I get the attached error. If I remove the "Cars : Count ." of the script it lists the year in groups but no totals.
for Cars ;
list records
Year in groups with group-totals .
Cars : Count .
Re:Re:Re:Listing records in groups with a count.
You have managed to change Josef's script so it doesn't work.
; is the termination character if there is more to follow . is for the last item.
List records
Item1 ;
Item2 ;
ItemN ;
LastItem .
Re:Re:Re:Re:Listing records in groups with a count.
OK, but the following has this error when I try to save. What needs to change in the last line of the script?
for Cars ;
list records
Year in groups with group-totals ;
Cars : Count .
Re:Re:Re:Re:Re:Listing records in groups with a count.
The problem is that you have no field called Cars in the table.
I guess you have one called Make.
If you simply want the count of the year you can simply do
for Cars;
list records
Year in groups ;
Year : Count .