Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

NumRange ( From ; To )

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.0  (46 votes)
  Discuss this Custom Function

Ray Cologon, NightWing Enterprises
http://www.nightwing.com.au/FileMaker

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

Sample Input:
Numrange ( 14 , 19 )
Sample Output:
14
15
16
17
18
19


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

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.

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

This is my Custom Function and I want to edit it

Discuss:

5 most recent comments | Show all 7 comments

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...

Johan S, Malmö Sweden
January 22, 2012 6:05am

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).

Nur Ritter, Hancock, NH
November 03, 2014 7:34am

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:

If(
GetAsNumber(To) > GetAsNumber(From);
GetAsNumber(From) & "¶" &
NumRange(GetAsNumber(From) + 1; To);
GetAsNumber(From)
)

mmaass, Tinseltown
November 25, 2015 8:14am

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).

Regards,
Ray

Ray Cologon, Melbourne
November 25, 2015 1:13pm

you don't have to make it long . just write

NumRange (From;to)

Mark Avila, Manila, Philippines
May 26, 2016 11:43pm

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 3 + 2 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. decFromHex ( hexValue )
  (Mon, Oct 16, 12:34pm)
2. MonthYearList ( startmonth ; startyear ; numbermonth ; short )
  (Mon, Oct 16, 3:38am)
3. ErrorDescription ( errorNumber )
  (Wed, Sep 27, 2:51am)
4. decodeEntities (text)
  (Wed, Sep 27, 1:22am)
5. HexidecimalToNumber ( HexidecimalValue ; counter )
  (Mon, Sep 25, 12:39pm)
6. FixedFieldConverter ( Fieldname ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 ; f8 ; f9 ; f10 ; f11 ; f12 ; f13 ; f14 ; f15 ; f16 ; f17 ; f18 ; f1
  (Fri, Sep 15, 12:34pm)
7. ShannonEntropy ( text )
  (Thu, Sep 07, 5:59am)
8. LetterCount ( text ; summary )
  (Thu, Sep 07, 5:53am)

RSS Feed of Custom Functions