July 22, 201213 yr 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
July 22, 201213 yr Do you need this only for display, or is this going to be used in further calculations?
July 22, 201213 yr 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.
July 22, 201213 yr 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 July 22, 201213 yr by comment
July 22, 201213 yr 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?
July 22, 201213 yr 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?
July 22, 201213 yr 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.
July 22, 201213 yr 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