Brian Dunning's FileMaker Custom Functions

NumRange ( From ; To )

Generates a multi-key containing all values between two numbers.

  Average rating: 4.0 (45 votes) Log in to vote

Ray Cologon   Ray Cologon - Show more from this author
NightWing Enterprises

Share on Facebook Share on Twitter

  Sample input:
Numrange ( 14 , 19 )
  Sample output:

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

Matching an integer (number, date, time etc) to a range is now supported in FileMaker via multi-predicate relationhships using the < and > operators. However matching a range to a range (for example, where one would need to establish that either the start OR the stop date OR any date between in one range falls within the other range) may still require that at least one of the ranges be reduced to a quasi-entity in the form of a mult-key value.

For extensive range comparisons, a technique such as Mikhail Edoshin's Smart Ranges may still be applicable, but for more moderate requirements a simpler multi-key which uses recursion to extrapolate the key value set can be used.



Johan S   Johan S, Malmö Sweden
Dec 25, 2011
I cant get this to work.
Dont know what im doing wrong.

Is there any explanatory samplefile to be found somewhere?
Ray Cologon   Ray Cologon, Melbourne
Dec 25, 2011
Hi Johan,

There's not a lot to explain other than what'e set out here. However if it helps, you'll find a simple demo that shows the function working at:
Johan S   Johan S, Malmö Sweden
Jan 22, 2012
Yepp the small demo works great.
My own implementation however showed only first and last number and I still havent figured out why.

But never mind, now it works - in mysterious ways...
Nur Ritter   Nur Ritter, Hancock, NH
Nov 3, 2014
I had the same experience. The demo works fine, but in my own database, I'm having the same experience as Johan (it shows just the first and last number).
mmaass   mmaass, Tinseltown
Nov 25, 2015
It might be the function does not reliably work because the ¶ is NOT quoted. But FileMaker doesn't complain when the calculation is closed, which is odd.

Try the following:

GetAsNumber(To) > GetAsNumber(From);
GetAsNumber(From) & "¶" &
NumRange(GetAsNumber(From) + 1; To);
Ray Cologon   Ray Cologon, Melbourne
Nov 25, 2015
There is no requirement to include quotes around a single carriage return character since the release of FileMaker 7 in March 2004.

Meanwhile, if implemented as set out in the original post here, the function works as described and produces a sequential list of numbers between the From and To values. It has been tested in all versions of FileMaker between version 7 and 14 inclusively and works correctly in all of them. We have also implemented it in dozens of solutions without encountering any problems.

However if regional settings for the file and system don't match, a number entered with "unexpected" thousand separators may not be interpreted appropriately. This can result in a data type-casting problem if values are supplied as text strings. For example the values 1411 and 2411, if passed as the "from" and "to" parameters with "." included as thousand separators (as in some EU countries) - i.e. as 1.411 and 2.411 - may be interpreted by the calc engine as decimal fractions, leading to the issue described by Johan.

In this case the solution would be to supply explicitly numeric values (i.e. ensuring they aren't passed to the function with thousand separators included).

Mark Avila   Mark Avila, Manila, Philippines
May 26, 2016
you don't have to make it long . just write

NumRange (From;to)

Log in to post comments.


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

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 16 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: