1 Reply Latest reply on Jun 21, 2011 10:02 AM by philmodjunk

    Average function from portal records

    DavidMenlow

      Title

      Average function from portal records

      Post

      This may end up being a simple answer, but I am unfamiliar with how to apply the 'average' function to a specific field displayed in a portal.  Here is what I need.  The file in which I have the portal displaying data is called Current.  The data in the portal is from a file called Historical.  The Historical file contains about 15,000 records.  The portal sorts and dislays the records  from the Historical file on a descending order by date.  One of the fields displayed in the portal calculates a percentage of some data in that Historical file, which I will call Percentage.  What I am looking for is to be able to take just the 1st 10 records displayed in a portal from this file and calculate an average of the field Percentage to just those 1st 10 records.  Some records may not show 10 records from the Historical file.  I have no idea where to even start with this, if it can done at all.

      I have attached a screen shot of what this looks like.  All 4 of the portals display records from the Historical file and the colored boxes are the percentage fields that I need averaged.

      Thanks for your help,

      David Menlow

      FSC_-_Fifth_Street_Finance.png

        • 1. Re: Average function from portal records
          philmodjunk

          If it was just the average of all the records in the portal, this would be very simple. Average ( Portaltable::PortalField ) would return the average of Portal field for all related records in Portaltable.

          Trying to limit this to just the "first 10" makes this much harder to do. We'd need either a relationship that matches only to those 10 records or a script that finds those 10 and copies the average back to a field on this layout before we could produce such a value.

          What determines which records are listed first in these portals? Is there a specified sort order or are they listed in unsorted order (which is the order in which they were created)?