Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Sum top 3 rows in a portal

Featured Replies

Greetings,

I've got a portal row which displays the time for runners in each row. Outside the portal, I have a field which calculates the Sum time of all the runners within the portal.

What I have been trying to accomplish now is to have another field which makes a Sum of the top 3 times within the portal.

Let's say we have 4 runners with:

Runner 1 - 1 minute

Runner 2 - 4 minutes

Runner 3 - 1 minute

Runner 4 - 1 minute

Top 3 times sum: 3 minutes

Does anyone know how to achieve this?

Thanks

Do you need this only for display, or is this going to be used in further calculations?

  • Author

Do you need this only for display, or is this going to be used in further calculations?

Thanks for the reply, it was only to display and then to be used for sorting in a printing view.

I have been able to get it done with GetLayoutObjectAttribute ( "ObjectName" ; "Content" ; 1 ; n ) which so far seems to be working beautifully, although a solution which doesn't require being in the layout would be even better in case I need to do calculations on it in the future.

it was only to display and then to be used for sorting in a printing view.

Well, if it's to be used for sorting, then it's not "only to display".

If you sort your relationship by Time, descending ascending, you can then sum up the three best results as =

GetNthRecord ( Results::Time ; 1 ) +

GetNthRecord ( Results::Time ; 2 ) +

GetNthRecord ( Results::Time ; 3 )

Edited by comment

  • Author

Well, if it's to be used for sorting, then it's not "only to display".

If you sort your relationship by Time, descending, you can then sum up the three best results as =

GetNthRecord ( Results::Time ; 1 ) +

GetNthRecord ( Results::Time ; 2 ) +

GetNthRecord ( Results::Time ; 3 )

Sorry, didn't consider sorting as a calculation, my mistake.

Tried that option, but for some reason it would only sort by creation date and spent quite some time trying to get it to work that way, but upon reading the documentation it explained it could only do it that way and I gave up that method.

Edit: Thinking about it, maybe I was sorting incorrectly? I tried sorting both the current table and the related table, is there another way to sort a relationship through the relationships window or something like that?

If you sort your relationship by Time, descending, you can then sum up the three best results as =

GetNthRecord ( Results::Time ; 1 ) +

GetNthRecord ( Results::Time ; 2 ) +

GetNthRecord ( Results::Time ; 3 )

Shouldn't it be ascending, since greater time = worse result?

Sorry, didn't consider sorting as a calculation, my mistake.

Well, it's not exactly a calculation either. I guess the mistake was mine for not allowing a wider margin for "things that are not display".

Tried that option, but for some reason it would only sort by creation date

Not sure what you mean by that: you need to set the sort order of the result records in the definition of the relationship.

Shouldn't it be ascending, since greater time = worse result?

Right. Thanks for the catch.

  • Author

Not sure what you mean by that: you need to set the sort order of the result records in the definition of the relationship.

Had never used this part when defining a relationship, had to look around for it but this works great now, thanks for the help!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.