Struggling with Median
As FM has no median function we have to program it. I've set up a little test environment with either 13 or 14 records, numbered 1 to 14, to get a median from.
Have been working with this script from another page on the forum:
Go To record/Request/Page [ Div ( Get ( FoundCount ) ; 2 ) ; no dialog ]
If [ Mode ( Get ( FoundCount ) ; 2 ) // odd number of records in found set ]
Set Variable [$Median ; valu:e ( YourTable::LOS + GetNthRecord ( YourTableLOS ; Get ( RecordNumber ) + 1 ) / 2 ]
Set Variable [$Median ; value: YourTable::LOS]
I'd expect it to return the middle number in an odd range, which it does. However, in an even range, I'd expect the middle two numbers divided by 2, but only the first appears.
My data is sorted high to low, so 8 and 7 respectively should be added and divided to give 7.5 in an even range. I'm just getting 8 when the variable is transferred to the reporting cell.
Thanks in advance