Brian Dunning's FileMaker Custom Functions

Combine ( decimal ; ObjList )

Get a substring under mask

  Average rating: 4.2 (24 votes) Log in to vote

Erich Schmidt   Erich Schmidt - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
Combine(35;"ABCDEF")
Combine(2^3+2^2;"76543210")
  Sample output:
AEF
32

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

The function returns a substring of "ObjList". The binary form of "decimal" is considered as a mask that overlies the string "ObjList".
A character of "Obj List" is selected, if the coresponding character in the mask is 1.

The function call

CustomList ( 1 ; 2^4-1 ; "Combine ( [n] ; \"ABCD\" ) " ) returns a list with all subsets of "ABCD":

D
C
CD
B
BD
BC
BCD
A
AD
AC
ACD
AB
ABD
ABC
ABCD

For TEXT="TELEPHONE" returns

Let ( [ $N= Length ( TEXT ) ]; CustomList ( 1 ; $N ; "Combine ( 2^$N - 2^($N-[n]) ; TEXT )" ) ) ;

the list

T
TE
TEL
TELE
TELEP
TELEPH
TELEPHO
TELEPHON
TELEPHONE

For TEXT="AaBbCcDdEeFfGg" with

Let( [ $MyList= CustomList ( 1 ; Div ( Length ( TEXT ) ; 2 ) ; "2^(2*[n]-1)" ); S= Evaluate ( Substitute ( $MyList ; ΒΆ ; "+" ) ) ]; Combine ( S ; TEXT ));

you get "ABCDEFG"

 

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 15 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: