Brian Dunning's FileMaker Custom Functions

png1x1 ( hex_string )

Used to set a container field to a 1x1 .png

  Be the first to rate this function Log in to vote

Tony White   Tony White - Show more from this author
Tony White Designs, Inc.
http://www.twdesigns.com/

Share on Facebook Share on Twitter

  Sample input:
Case (
Status = "Rec. Partial" ; png1x1 ( "fc9" ) ;
Status = "Rec. All" ; png1x1 ( "ccf" ) ;
Status = "Ordered" ; png1x1 ( "fcc" ) ;
Status = "On Hold" ; png1x1 ( "ff9" ) ;
Status = "Planned" ; png1x1 ( "cff" ) ;
""
)
  Sample output:
a 1x1 .png

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

Used to set a container field to a 1x1 .png

Here are some colors that we like. Also easy to work with!
http://www.twdesigns.com/resources/documentation/f/filemaker-7-to-11-default-color-palette/

use case: set a container field based on the value of another field, for example...
Status & Status_Color_R, Priority & Priority_Color_R, etc.

Might be used instead of a Conditional Format Fill to provide a DRYer implementation that is more flexible.

Inspired by CF "colors_for_containers ( color_name ; opacity )" ; https://www.briandunning.com/cf/1828

 

Comments

Tim Anderson   Tim Anderson, Tim Anderson Group
Feb 24, 2021
Thanks Tony, useful. If I can I would like to suggest that if an empty string is passed as the parameter then the content is cleared.
Quick and dirty..

~result = Case(IsEmpty(hex_string );""; Base64Decode ( ~png1x1_base64enconded ; hex_string & ".png" ))
 
Tony White   Tony White, Tony White Designs, Inc.
Feb 28, 2021
Hi Tim, Interesting idea. Added it as v2.

In the v1 a blank value seems to fall to the default and clear. That said, an intentional empty value could be handled explicitly at the top of the Case Function, while a missing value could be handled as a default Case/color/PNG TBD.

Thanks for the feedback.
 

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: