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

NumberList ( start ; end ; increment )

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.4  (37 votes)
  Discuss this Custom Function

Gordon Kilgour, n/a
n/a

Returns a list of numbers from 'start' to 'end', incremented by 'increment'

Sample Input:
NumberList ( 2 ; 5 ; 0.5 )
Sample Output:
2
2.5
3
3.5
4
4.5
5


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

Description:

Returns a carriage-return separated list of the numbers from 'start' to 'end' inclusive, incremented by the 'increment' value. Good for a Pop-up Menu or Drop-down List to limit user entry to specific values.

For example, for all even numbers from 2 to 8,
NumberList ( 2 ; 8 ; 2 ) would return:-
2
4
6
8

For all tens from 50 to 100,
NumberList ( 50 ; 100 ; 10 ) would return:-
50
60
70
80
90
100

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

Thank *you* -- I used it to generate the X-axis in a FileMaker charting script.

Marc Wood, Minneapolis MN
September 22, 2010 7:27pm

It hits the 10,000 recursion limit:

NumberList( 0 ; 10000 ; 1 ) = ?

Vaughan, Sydney, Australia
July 28, 2011 4:58pm

That is true Vaughan but for practical purposes it's irrelevant. It would also be very simple to add a check for this.

Gordon Kilgour, Edinburgh
May 15, 2012 3:51am

Useful!
I added some things that let you increment/decrement by picking a positive/negative 'changeBy' parameter. Note that if changeBy is negative, then your rangeStart must be greater than rangeEnd.

// ValueNumbersFromRange ( rangeStart; rangeEnd; changeBy )
// version 1.0, Daniel A. Shockley, inspired by Gordon Kilgour's NumberList, http://www.briandunning.com/cf/1172

// Generate a return-delimited list of numbers for the specified range by the specified increment.

/* VERSION HISTORY:
1.0 - intitial version.
*/


Case (

changeBy = 0 /* ERROR */
; "?"
;
changeBy > 0 and rangeStart > rangeEnd /* ERROR */
; "?"
;
changeBy < 0 and rangeStart < rangeEnd /* ERROR */
; "?"
;
rangeStart = rangeEnd
; rangeStart
;
List ( rangeStart; ValueNumbersFromRange ( rangeStart + changeBy; rangeEnd; changeBy ) )
)

Dan Shockley, New York, NY
August 26, 2014 2:23pm

Actually, don't return "?" if the rangeEnd/rangeStart seem wrong, since you might be going from 2 to 7 incrementing by 2 and don't want to get 2¶4¶6¶?
Instead, just return "" when that happens so you would get, in this example, 2¶4¶6

Updated calc:
// ValueNumbersFromRange ( rangeStart; rangeEnd; changeBy )
// version 1.0, Daniel A. Shockley, inspired by Gordon Kilgour's NumberList, http://www.briandunning.com/cf/1172

// Generate a return-delimited list of numbers for the specified range by the specified increment.

/* VERSION HISTORY:
1.0 - intitial version.
*/


Case (

changeBy = 0 /* ERROR */
; "?"
;
changeBy > 0 and rangeStart > rangeEnd /* Finished */
; ""
;
changeBy < 0 and rangeStart < rangeEnd /* Finished */
; ""
;
rangeStart = rangeEnd
; rangeStart
;
List ( rangeStart; ValueNumbersFromRange ( rangeStart + changeBy; rangeEnd; changeBy ) )
)

Dan Shockley, New York, NY
August 27, 2014 8:14am

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 5 + 1 =
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. HexUUIDToNum_cf (_uuid)
  (Sat, Jun 16, 1:55pm)
2. httpResponseCode ( responseHeaders )
  (Tue, Jun 12, 10:40pm)
3. FindDuplicateCharacters ( string )
  (Fri, Jun 08, 5:01pm)
4. FieldRepetitionLast ( field ; maxRepetition )
  (Wed, Jun 06, 6:05pm)
5. CountModifiedRecords ( NameTimestampField ; StartTimestamp ; EndTimestamp )
  (Mon, May 28, 8:23am)
6. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
7. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)
8. @JSONFormatElements ( json )
  (Tue, May 15, 3:31am)

RSS Feed of Custom Functions