# COUNTing the number of similar records

**URL:** <https://www.dynamicsuser.net/t/counting-the-number-of-similar-records/4961>\
**Category:** Developers Forum\
**Created:** [April 18, 2001, 3:27pm UTC](https://www.dynamicsuser.net/t/counting-the-number-of-similar-records/4961 "2001-04-18T15:27:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FormerMember](https://avatars.discourse-cdn.com/v4/letter/f/74df32/32.png) [@FormerMember](https://www.dynamicsuser.net/u/FormerMember)\
**Post date:** [April 18, 2001, 3:27pm UTC](https://www.dynamicsuser.net/t/counting-the-number-of-similar-records/4961/1 "2001-04-18T15:27:51Z")

</div>

Hi, Does anyone knows a simple way to count the number for records that have the same value. For example, if a field “Container Type” can have 5 different value then I want to count, while generating a report, that the number of shipments (per shipping company or destination) have been made per “Container type”. For more clearification, Shipper – Cont.type – Nr. of cont. XYZ ---------- 1 ---------- 10 --------------- 2 --------- 15 and so on … Thanks in advance. Tariq

---

<div class="post-metadata">

**Author:** ![lars\_westman](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@lars\_westman](https://www.dynamicsuser.net/u/lars_westman)\
**Post date:** [April 18, 2001, 9:25pm UTC](https://www.dynamicsuser.net/t/counting-the-number-of-similar-records/4961/2 "2001-04-18T21:25:48Z")

</div>

Try this: Set up a key on the table with Shipper and Cont.type Then suppress the bodysection and only show the group footers where You show a counter that You reset in OnPostSection Trigger. The counter should be increased in the OnAfterGetRecord Trigger

---

<div class="post-metadata">

**Author:** ![FormerMember](https://avatars.discourse-cdn.com/v4/letter/f/74df32/32.png) [@FormerMember](https://www.dynamicsuser.net/u/FormerMember)\
**Post date:** [April 19, 2001, 11:10am UTC](https://www.dynamicsuser.net/t/counting-the-number-of-similar-records/4961/3 "2001-04-19T11:10:27Z")

</div>

Thanks for help Lars. Your solution works but now I’m experiencing another problem. That is, repport is counting in batches. Output is like … Shipper : XYZ Container type ----- Nr. of Containers ------ 1 ------------------ 5 ------ 2 ------------------ 11 ------ 5 ------------------ 7 ------ 2 ------------------ 1 ------ 2 ------------------ 8 ------ 1 ------------------ 25 Do you have any idea how to further add similar types together? Could this be because of the active Key, which is, Shipper,Destination,Cont.type ? If yes, is it possible to get the required result on this Key? Since I need to group by ‘Destination’ as well. The report would switch between ‘Shipper’ & ‘Destination’, depending on the filters applied. Thanks a lot. Tariq
