Brian Dunning's FileMaker Custom Functions

CollapseList ( listOfValues )

Collapses a list of values by replacing serially incrementing sections with their range boundaries.

  Average rating: 3.9 (53 votes) Log in to vote

Michael Horak   Michael Horak
*COMMENT Visual Realisation
http://comment.cjb.net

Share on Facebook Share on Twitter

  Sample input:
CollapseList ( listOfValues )
with the following listOfValues:
Invoice 1
Invoice 2
Invoice 4
Invoice 5
Invoice 6
Invoice 7
Invoice 8
Invoice 9
Invoice 10
Invoice 11
Invoice 12
Invoice 18
Receipt 52
Receipt 53
Receipt 54
  Sample output:
Invoice 1, Invoice 2, Invoice 4 to Invoice 12, Invoice 18, Receipt 52 to Receipt 54

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

Collapses a list of values by replacing serially incrementing sections with their range boundaries.

The result is a comma-separated list of ranges and individual values. The list separator and the range placeholder can be easily modified or defined as additional function parameters.

Values are compared in the order they appear in the list. For best results, the list should be sorted in ascending order.

 

Comments

Andrey Kolganov   Andrey Kolganov, Moscow, Russia
May 19, 2011
How about this way?

Substitute( listOfValues ; "¶" ; ", ")
 
comment   comment, VR
May 19, 2011
Try it and see the difference.
 

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.

Under construction. Email me your wish list for improvements.