Brian Dunning's FileMaker Custom Functions

reverseSortedNumberList ( start ; iterations )

Number list (i.e. years) for reverse-sorted value list

  Average rating: 4.7 (26 votes) Log in to vote

Jonathan Fletcher   Jonathan Fletcher
Fletcher Data Consulting

Share on Facebook Share on Twitter

  Sample input:
reverseSortedNumberList ( 2015 ; 5 )
  Sample output:
.....2011
....2012
...2013
..2014
.2015

Where "." = char ( 65279 )

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Creates a reverse-sortable value list of the number series. Is makes use the zero-width "byte-order mark" technique first brought to our attention by Marcelo Piñeyro of Soliant. If you create a dynamic value list pointing at a field with this calculation in it it will give you a value list of the numbers with the highest value first. This solves the issue of dynamic lists always having the lowest value first. Also cudos to Agnes Barouh and her co-conspirators who gave us the ever-useful CustomList function.

One other feature included is the option to just say "Current Year" in the first parameter (or just leave it blank ) and have the start number be whatever the current year is.

Dependencies:
The CustomList function
A Repeat ( character ) function
Setting the resultant dynamic value list to Sort As Unicode

Piñeyro's article on the Soliant site:
http://www.soliantconsulting.com/blog/2012/09/extending-filemaker-pro’s-value-list-sort-capabilities-using-char-function

CustomList: http://www.briandunning.com/cf/868

Repeat: http://www.briandunning.com/cf/726

Bonus tip: Set the entry field that uses this function to auto-enter calculate out the Char ( 65279 ) if the field will be used in a calculation or relationship. A simple Substitute ( self ; Char ( 65279 ) ; "" ) (Do Not Replace OFF) does the trick.

 

Comments

Daniele Raybaudi   Daniele Raybaudi, ACI
Aug 30, 2013
Do you know that, at the end, we'll have 3 not empty variables ?
Why did you use $var ?
 
Jonathan Fletcher   Jonathan Fletcher, Fletcher Data Consulting
Sep 2, 2013
Yes, I don't like that, but CustomList resists my efforts to use internally-scoped variables. I use the function in a field definition and the $variables don't cause any problem. Agreed, using them in a script would leave them hanging, but that doesn't seems to cause any problems and they'll go away after the script anyway.
 
Robert Charlton   Robert Charlton, Melbourne.au
Nov 4, 2016
http://www.soliantconsulting.com/blog/2012/09/extending-filemaker-pro’s-value-list-sort-capabilities-using-char-function

Link no longer valid
NOT FOUND
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.