How to show the number of portal rowsPosted: August 24, 2011
Often, I need to show the number of records shown in a given portal. This may or may not be the same as a found count, or total record count – when using portal filtering, different portals can show different subsets of the related records, so it’s not as simple as just showing the total number of records.
The easiest way seems to be to use a Summary field from the related TO – usually just a simple “count of ID”. The value in the summary will change according to where the field is displayed, and in a portal, it will show the number of related recs shown in that portal.
The problem with this is that, in order to show the number of records in the portal, it has to be shown IN the portal, and therefore on every portal row. But usually you won’t want it displayed on every portal row – usually I just want it once, at the top of the portal. So the trick is to DUPLICATE the portal, and shrink it to the absolute minimum, i.e. one row, no scrollbar, and resized to just the size of the one summary field. Obviously it needs to be FILTERED in the same way as the portal which is actually displaying the records.
Here’s an example:
The main portal shows a filtered set of records from the Attendances table. The “mini-portal”, which is simply the “3” record count, is a miniaturised copy of the same portal, containing the one Summary field, ATT_s_Count, defined as “Count of ATT__kp_ID”. The same field is used elsewhere on the same layout, to show the count of a differently filtered subset of Attendance records.