Brian Dunning's FileMaker Custom Functions

ValueShuffleMerge ( valueList1 ; valueList2 )

Semi-randomly merges two value lists, like riffling two half-decks of cards

  Average rating: 4.5 (26 votes) Log in to vote

Jeremy Bante   Jeremy Bante

https://github.com/jbante/

Share on Facebook Share on Twitter

  Sample input:
Let ( [
~valueList1 = "1¶2¶3";
~valueList2 = "a¶b¶c¶d"
];
List (
Substitute ( ValueShuffleMerge ( ~valueList1 ; ~valueList2 ) ; ¶ ; ", " );
Substitute ( ValueShuffleMerge ( ~valueList1 ; ~valueList2 ) ; ¶ ; ", " );
Substitute ( ValueShuffleMerge ( ~valueList1 ; ~valueList2 ) ; ¶ ; ", " );
Substitute ( ValueShuffleMerge ( ~valueList1 ; ~valueList2 ) ; ¶ ; ", " )
)
)
  Sample output:
1, a, 2, b, c, d, 3
1, a, b, 2, 3, c, d
a, 1, 2, b, 3, c, d
a, 1, b, c, 2, 3, d

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

Merges the return-delimited values in valueList1 and valueList2, such that values in the new list will be in the same order relative to other values from the same source list, but random order relative to values in the other list. This is analogous to riffling together two halves of a deck of cards when shuffling the deck.

 

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: