2 Replies Latest reply on Sep 11, 2015 8:08 AM by imarc

    How do I count the rows in a portal?


      Hi all:

      Thanks to the great help I've gotten here, I'm making a lot of progress in my World War II database for my dad's outfit during the war.  The attached image is from one record (1 of 311 records) with a few facts about an individual airplane.  The portal shows the chronological sequence that the plane flew each mission.  The mission table provides the mission number (1-280), the date the mission was flown, target bombed, aircraft identification, bombing results, and the number of hours flying time for each mission.  At the bottom is the summation of total flying time for each aircraft.

      What I would like to do is add another field down by total flying time to display a numerical number of the count of missions flown.  If a plane flew every mission, then that number would be 280.

      I'm assuming it would be as simple as defining a field in the layout set to a value of 1 that gets added to some accumulator (display counter).  Every time a new row is added, the accumulator is incremented.  The ID field shows the current record number (16).  If I go to another record, how do I clear the accumulator so that I get a clean count for the next airplane?

      Counter example.JPG

        • 1. Re: How do I count the rows in a portal?

          Assuming the tables pertinent to your question are called Airplane and Mission …


          Create a summary field in Mission as Count Of: <anyNonEmptyField> (use the primary key).

          Put that field onto your Airplane layout.

          Be aware that this sometimes is a bit slow to refresh. Another approach is to create a non-stored! calc field in Mission as Get ( FoundCount ), and put that onto the layout.

          The nice thing is that if you have, say, a City table (location of mission) related to Mission, then you can put either of these fields on a City layout, and it will give you the correct mission count for that city.

          • 2. Re: How do I count the rows in a portal?

            Another option that doesn't require creating an additional field is to add another single-row portal with the same relationship (and with the same filtering, if any), and within the portal, create a text object and use the Insert->Other Symbol menu command to add {{FoundCount}}. The portal and contained text object are selected in the screenshot below: