CustomQuickSort ( values ; valueFunction ; direction )
QuickSort using custom evaluation
Average rating: 3.5 (2 votes) Log in to vote
Richard Dyce - Show more from this author
Dyce & Sons Ltd. http://dyce.com |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
This is an extension of the existing QuickSort( list ) function from Jeremy Bante ( OshVay Systems, Inc. http://www.oshvay.com).
It allows you to effectively use a comparison function so that you can sort more complex values. For example, given a list of coordinates:
"3,5¶4,2¶1,3¶4,1¶1,7¶2,0¶1,9"
You can sort them by their y coordinate:
CustomQuickSort ( "3,5¶4,2¶1,3¶4,1¶1,7¶2,0¶1,9" ; "GetAsNumber( Middle( \"[t]\" ; Position( \"[t]\" ; \",\" ; -1 ; 1 ) + Length( \",\" ) ; 64000 ) )" ; True )
gives:
"2,0¶4,1¶4,2¶1,3¶3,5¶1,7¶1,9"
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.