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 (54 votes) Log in to vote

Michael Horak   Michael Horak - Show more from this author
*COMMENT Visual Realisation

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.

See also GapsInSequence() https://www.briandunning.com/cf/2605

 

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.

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: