list.range ( )

Function stats

Average user rating
29
192
9999
Support
FileMaker 8.0 +
Date posted
28 January 2009
Last updated
28 January 2009
Version
Recursive function
Yes

Author Info
 Genx

18 functions

Average Rating 4.1

author_avatar



 

Function overview

Prototype

list.range  ( low;   high;   step )


Parameters

low  Low value.


high  High value.


step  If a step value is given, it will be used as the increment between elements in the sequence. step should be given as a positive number. If not specified, step will default to 1.


Description

Tags:  range   PHP   list  

Returns a list of elements from low to high , inclusive. If low > high, the sequence will be from high to low.

Replicates the functionality of the php range function: http://php.net/range

list.range(15 ; 12 ;"" ) -> 15¶14¶13¶12

Examples

Sample input

list.range(12 ; 14 ; 1 )


Sample output

12¶13¶14

 

Function code

Let([
stepSize = If( IsEmpty(step) ; 1 ; GetValue( step ; 1 ) );
dir = If( ValueCount(step) < 2 ; If( low > high ; "r" ; "f" ) ; GetValue( step; 2 ) ) ;
step = stepSize & ¶ & dir
];
    Case(
    dir = "f" ; If( low + stepSize <= high ; low & ¶ & list.range( low+stepSize ; high ; step ) ; low) ;
    dir = "r" ; If( low - stepSize >= high ; low & ¶ & list.range( low-stepSize ; high ; step ); low )
    )
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/192

    Prototype: list.range( low; high; step )
    Function Author: Genx (http://www.fmfunctions.com/mid/29)
    Last updated: 28 January 2009
    Version: 1.1

*/
// ===================================

 

 

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (32)
Date  (28)
XML  (27)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (13)
Filter  (12)
Layout Objects  (11)
Design  (10)
Array  (8)