restOfList ( )

Function stats

Average user rating
47
180
9999
Support
FileMaker 7.0 +
Date posted
08 January 2009
Last updated
08 January 2009
Version
Recursive function
No

Author Info
 BruceR

1 functions

Average Rating None

author_avatar



 

Function overview

Prototype

restOfList  ( theList )


Parameters

theList  


Description

Frequently in looping scripts you want to take the first value in a list, do something with this value, then drop it from the top of the list and work through the remainder of the list.
Example:
Set Variable( $colors; "Red¶Green¶Blue")
Loop
exit loop if isEmpty( $colors)
Set Variable( $thisColor; getValue( $colors; 1))
// do something with $thisColor
Set Variable( $colors; restOfList( $colors ))
End Loop

Examples

Sample input

RestOfList( "Red¶Green¶Blue" )


Sample output

"Green¶Blue"

 

Function code

middleValues( theList; 2; valueCount( theList ) -1 )

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

    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/180

    Prototype: restOfList( theList )
    Function Author: BruceR (http://www.fmfunctions.com/mid/47)
    Last updated: 08 January 2009
    Version: 1.2

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

 

Comments

uLearnIT
08 January 2009



Certainly a useful CF for the arsenal.
Could this not also be done using:
RightValues ( theList ; ValueCount ( theList ) - 1 )
I doubt it makes much difference ;-)
(Edited by uLearnIT on 08/01/09 )
  General comment
Genx
09 January 2009



As a general note (again, not that it really matters), the -1 isn't all that necessary. FileMaker doesn't seem to care if the 3rd parameter is greater than the number of remaining values.

E.g. MiddleValues( "test¶test2¶test3" ; 2 ; 10 ) still returns "test2¶test3"
  General comment
BruceR
09 January 2009



Yup, I'm aware of that.
  General comment

 

 

 

 

 

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)