Brian Dunning's FileMaker Custom Functions

Splice ( delimitedList ; start ; stop ; step )

Splices values out of a list given a starting point, stopping point, and an increment (step). Similar to Python's list[] notation.

  Average rating: 5.0 (1 vote) Log in to vote

Ethan   Ethan - Show more from this author
Tactile Medical
https://www.linkedin.com/in/ethyoder

Share on Facebook Share on Twitter

  Sample input:
Splice ( List ( "a" ; "b" ; "c" ; "d" ) ; 2 ; 4 ; 1 )
Splice ( List ( "a" ; "b" ; "c" ; "d" ) ; 1 ; -1 ; "" )
Splice ( List ( "a" ; "b" ; "c" ; "d" ) ; "" ; -3 ; -1 )
Splice ( List ( "a" ; "b" ; "c" ; "d" ) ; "" ; "" ; 2 )
  Sample output:
"b¶c"
"a¶b¶c"
"d¶c"
"a¶c"

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

All non-list parameters *must* be integers. Start and stop cannot be 0 as FM list convention starts lists at index 1.

This should work like splicing lists in Python (except lists start at index 1 in FM), so you should be able to...
- leave first value blank (iteration starts at beginning of list)
- leave last value blank (iteration ends at and *includes* last value of list)
- use negative indexes to refer to values at the end of lists (-1 = last value, -2 = 2nd to last value, etc.)
- leave step value blank (iterate forward by 1)
- iterate backward (negative step values)
- iterate by more than 1

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. 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 20 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: