Brian Dunning's FileMaker Custom Functions

badgeStack ( width ; height ; defaultArray ; badgeArray )

Generates overlapping circular badges with custom text and styles from JSON, rendered in SVG for display in a FileMaker Web Viewer.

  Be the first to rate this function Log in to vote

Jonni™   Jonni™ - Show more from this author

  Sample input:
badgeStack ( 400 ; 400 ; $defaultArray ; $pillArray )
  Sample output:
Row of SVG badges for use in a webviewer

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

This function produces a visually stacked row of circular badges using SVG, styled and controlled entirely via JSON. Each badge supports individual text, background and font colour, and border styles, with layout dynamically handled based on Web Viewer dimensions. The leftmost badge appears on top, enabling a clean and readable stack that’s perfect for representing users, tags, roles or assignments in FileMaker layouts.

Default Array Example

JSONSetElement ( "" ;

[ "radius" ; 16 ; 2 ] ;
[ "font.size" ; 12 ; 2 ] ;
[ "font.weight" ; "bold" ; 1 ] ;
[ "font.name" ; "Helvetica Neue" ; 1 ] ;
[ "spacing.overlap" ; 6 ; 2 ] ;
[ "border.stroke" ; 2 ; 2 ] ;
[ "border.color" ; "#FFFFFF" ; 1 ] ;
[ "background.fill" ; "#FFFFFF" ; 1 ]

)

Badge Array Example

JSONSetElement ( "" ;

[ "badge[+]text" ; "MR" ; 1 ] ;
[ "badge[:]color.background" ; "#F4511E" ; 1 ] ;
[ "badge[:]color.text" ; "#FFFFFF" ; 1 ] ;

[ "badge[+]text" ; "J" ; 1 ] ;
[ "badge[:]color.background" ; "#4285F4" ; 1 ] ;
[ "badge[:]color.text" ; "#FFFFFF" ; 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 21 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: