{"id":7690,"date":"2023-05-08T06:00:00","date_gmt":"2023-05-08T06:00:00","guid":{"rendered":"https:\/\/www.directimpactsolutions.com\/?p=7690"},"modified":"2025-05-01T03:22:53","modified_gmt":"2025-05-01T03:22:53","slug":"top-5-custom-filemaker-functions","status":"publish","type":"post","link":"https:\/\/www.directimpactsolutions.com\/en\/top-5-custom-filemaker-functions\/","title":{"rendered":"Top 5 Custom FileMaker Functions"},"content":{"rendered":"<h2 class=\"wp-block-heading\">What is a custom function?<\/h2><p><a href=\"https:\/\/www.directimpactsolutions.com\/en\/Custom-FileMaker-Solutions\/\" data-type=\"URL\" data-id=\"https:\/\/www.directimpactsolutions.com\/en\/Custom-FileMaker-Solutions\/\">Custom FileMaker<\/a> functions are functions defined by the developer that can be reused anywhere in the database file in which they are created.\u00a0As developers, we can find ourselves evaluating a calculation multiple times, which is a great sign to use a custom function. A great resource for custom functions is <a href=\"https:\/\/www.briandunning.com\/filemaker-custom-functions\/\" target=\"_blank\" rel=\"noreferrer noopener\">Brian Dunning&#8217;s <\/a>website.<\/p><h2 class=\"wp-block-heading\">Top 5 Custom Functions<\/h2><p>I realize that not everyone\u2019s definition of the <em>Top 5<\/em> custom functions will be the same. My top five custom functions are those that I use in multiple databases to save time, or simply those that I use often.<\/p><ul class=\"wp-block-list\"><li>SysPlatform<\/li>\n\n<li>RemoveValue<\/li>\n\n<li>Age<\/li>\n\n<li>Patternize<\/li>\n\n<li>IsServer<\/li><\/ul><h3 class=\"wp-block-heading\">SysPlatform<\/h3><h6 class=\"wp-block-heading\"><strong>Custom Function Definition<\/strong><\/h6><pre class=\"wp-block-code has-small-font-size\"><code><code>Let ( &#91;\nsystem = Get ( SystemPlatform ) ;\nplatform = Case ( \n\t\tsystem = 1 ; \"Mac\" ; \n\t\tsystem = -2 ; \"Win\" ; \n\t\tsystem = 3 ; \"iOS\" ; \n\t\tsystem = 4 ; \"Web\" ; \n\t\t\/\/defaultResult \n\t\t\"N\/A\"\n\t\t)\n] ; \n\nplatform\n\n)<\/code><\/code><\/pre><div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-fe9cc265 wp-block-group-is-layout-flex\"><p>When dealing with multi-platform solutions, it is imperative to track which platform the end user is on. I don&#8217;t know about you, but I tend to forget which numbers pertain to which system platform, hence why I use this custom function frequently. Instead of constantly using Get(SystemPlatform) and memorizing which number belongs to which platform, you can simply create a custom function that returns the platform. Once doing so, your script process is clearer to read and also quicker to implement.<\/p>\n\n<p><\/p>\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"474\" height=\"296\" src=\"https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/sysPlatform.png\" alt=\"\" class=\"wp-image-7705\" style=\"width:-37px;height:-23px\" srcset=\"https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/sysPlatform.png 474w, https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/sysPlatform-300x187.png 300w, https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/sysPlatform-400x250.png 400w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/figure><\/div><p><\/p><h3 class=\"wp-block-heading\">RemoveValue ( listOfValues ; value )<\/h3><h6 class=\"wp-block-heading\"><strong>Custom Function Definition<\/strong><\/h6><pre class=\"wp-block-code\"><code><code>\/*\nCUSTOM FUNCTION: RemoveValue(listOfValues; value)\nby Debi Fuchs of Aptworks Consulting, debi@aptworks.com\nSpeedily (and with no recursion or cleanup of empty values) remove all instances of a value from a list. (For cleanup try custom function CullNulls)\ne.g. RemoveValue(\"\u00b69\u00b62\u00b64\u00b68\u00b68\u00b6\u00b67\u00b6\u00b68\u00b69\u00b6\u00b6\"; \"8\") -&gt; \"\u00b69\u00b62\u00b64\u00b6\u00b67\u00b6\u00b69\u00b6\u00b6\"\nLAST MODIFIED: 28-AUG-2018 by Debi Fuchs of Aptworks Consulting\n*\/\n\nLet(\n  s = \"##*aaa*##\"; \/\/very unlikely string\n  Case(\n    \/\/Check if unlikely string rears its head\n    Position( listOfValues; s; 0; 1 );\n    \/\/If so, simulate an out-of-range error.\n    Evaluate( \"Factorial( -1 )\" ); \n    \/\/Check if value itself contains a paragraph return\n    Position( value; \u00b6; 0; 1 );\n    \/\/If so, simulate an out-of-range error.\n    Evaluate( \"Factorial( -1 )\" ); \n    \/\/ Otherwise, proceed to get rid of nulls\n    Substitute(\n      s &amp; listOfValues &amp; s;\n      &#91; \"\u00b6\"; s &amp; \u00b6 &amp; s ];\n      &#91; s &amp; value &amp; s &amp; \u00b6; \"\" ];\n      &#91; \u00b6 &amp; s &amp; value &amp; s; \"\" ];\n      &#91; s &amp; value &amp; s; \"\" ];\n      &#91; s; \"\" ]\n    )\n  )\n)<\/code><\/code><\/pre><p>FilterValues returns a text result containing only the values that were passed as filterValues, whereas this custom function is quite the opposite. Many times I have found myself needing to remove a specific value from a value list, which is when the RemoveValue custom function comes in handy.<\/p><h5 class=\"wp-block-heading\">Explanation of Parameters:<\/h5><p><strong>listofValues<\/strong> &#8211; value list<br><strong>value<\/strong> &#8211; value to remove<\/p><p><strong>Example:<\/strong><br>RemoveValue ( &#8220;Green&#8221;&amp;\u00b6&amp;&#8221;Red&#8221;&amp;\u00b6&amp;&#8221;Red&#8221;&amp;\u00b6&amp;&#8221;Purple&#8221; ; &#8220;Red&#8221; )<\/p><p><strong>Returns:<\/strong><br>Green<br>Purple<\/p><h3 class=\"wp-block-heading\">Age(Birthdate)<\/h3><div class=\"inherit-container-width wp-block-group alignwide is-layout-constrained wp-block-group-is-layout-constrained\"><div class=\"wp-block-media-text alignwide has-media-on-the-right is-stacked-on-mobile\"><div class=\"wp-block-media-text__content\"><p class=\"has-text-align-left\"><strong>Custom Function Definition<\/strong><\/p>\n\n<p class=\"has-text-align-left\">Year (Get(CurrentDate)) &#8211;<br>Year (BirthDate) &#8211;<br>(<br>Get (CurrentDate) &lt; Date (<br>Month (BirthDate);<br>Day (BirthDate);<br>Year (Get(CurrentDate))<br>)<br>)<\/p><\/div><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"923\" height=\"520\" src=\"https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited-1.png\" alt=\"\" class=\"wp-image-7733 size-full\" srcset=\"https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited-1.png 923w, https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited-1-300x169.png 300w, https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited-1-768x433.png 768w, https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited-1-480x270.png 480w\" sizes=\"auto, (max-width: 923px) 100vw, 923px\" \/><\/figure><\/div><\/div><p>I&#8217;m sure many of us have found ourselves needing the age of a person in a record and this custom function does this and calculates the age.<\/p><p><strong>Birthdate<\/strong> \u2013 date of birth field you will be using to check age<\/p><h3 class=\"wp-block-heading\">Patternize ( direction ; pattern ; replaceChar ; value ; pad? )<\/h3><p>Have you ever found yourself needing a specific format for a phone number or perhaps you have to mask out credit cards and just display the last 4 digits? This custom function allows you to do both.  You insert the pattern and it will output the format you desire.&nbsp;<\/p><div class=\"inherit-container-width wp-block-group alignwide is-layout-constrained wp-block-group-is-layout-constrained\"><div class=\"wp-block-media-text alignwide is-stacked-on-mobile\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"1000\" height=\"618\" src=\"https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/number.jpeg\" alt=\"patternize\" class=\"wp-image-7729 size-full\" srcset=\"https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/number.jpeg 1000w, https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/number-300x185.jpeg 300w, https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/number-768x475.jpeg 768w, https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/number-980x606.jpeg 980w, https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/number-480x297.jpeg 480w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure><div class=\"wp-block-media-text__content\"><p><strong>Explanation of Parameters:<\/strong><\/p>\n\n<p><strong>direction<\/strong> \u2013 LTR (left to right) or RTL (right to left)<br><strong>pattern<\/strong> \u2013 format you desire<br><strong>replaceChar <\/strong>&#8211; Character in that pattern I want replaced with data<br><strong>value <\/strong>\u2013 data that is passed<br><strong>pad?<\/strong> \u2013 0 \u2013 I don\u2019t want to include the rest of the pattern once I run out of data<\/p><\/div><\/div><\/div><h5 class=\"wp-block-heading\"><\/h5><p><strong>Example:<\/strong><\/p><p>Patternize ( &#8220;LTR&#8221; ; &#8220;###-###-####&#8221; ; &#8220;#&#8221; ; &#8220;7183233333&#8221; ; 0 )<br>Patternize ( &#8220;LTR&#8221; ; &#8220;###-###-#### x ###&#8221; ; &#8220;#&#8221; ; &#8220;7183233333343&#8221; ; 0 )<br>Patternize ( &#8220;RTL&#8221; ; &#8220;xxxx-xxxx-xxxx-####&#8221; ; &#8220;#&#8221; ; &#8220;5288105898105340&#8221; ; 0 )<\/p><p>718-323-3333<br>718-323-3333 x 343<br>xxxx-xxxx-xxxx-5340<\/p><h3 class=\"wp-block-heading\">IsServer<\/h3><h6 class=\"wp-block-heading\">Custom Function Definition<\/h6><pre class=\"wp-block-code\"><code><strong>PatternCount( Get( ApplicationVersion ); \"Server\" ) &gt; <\/strong><\/code><\/pre><p><strong>This function will determine in a boolean manner whether or not a script is running on the FileMaker Server.<\/strong><\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"936\" height=\"122\" src=\"https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/server.png\" alt=\"\" class=\"wp-image-7723\" srcset=\"https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/server.png 936w, https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/server-300x39.png 300w, https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/server-768x100.png 768w, https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/server-480x63.png 480w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><\/figure><p>The majority of all Filemaker developers have a OnOpen script for their solution. When running scripts on the server, we usually don\u2019t need to run the OnOpen script. To bypass this instead of creating an if statement and writing out the code we can simply call this custom function.<\/p><p>If you&#8217;d like to play around with these versatile functions, check out our demo file:<\/p><div class=\"wp-block-file\"><a id=\"wp-block-file--media-a5545c37-123f-42a3-a984-6ea8a0839b5c\" href=\"https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/12\/CustomFunctions_Demo-File.fmp12-1.zip\">CustomFunctions_Demo-File.fmp12-1<\/a><a href=\"https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/12\/CustomFunctions_Demo-File.fmp12-1.zip\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-a5545c37-123f-42a3-a984-6ea8a0839b5c\">Download<\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>What is a custom function? Custom FileMaker functions are functions defined by the developer that can be reused anywhere in the database file in which they are created.\u00a0As developers, we can find ourselves evaluating a calculation multiple times, which is a great sign to use a custom function. A great resource for custom functions is &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/www.directimpactsolutions.com\/en\/top-5-custom-filemaker-functions\/\"> <span class=\"screen-reader-text\">Top 5 Custom FileMaker Functions<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":18,"featured_media":7731,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","footnotes":""},"categories":[29],"tags":[175,39],"class_list":["post-7690","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-low-code","tag-custom-functions","tag-filemaker"],"uagb_featured_image_src":{"full":["https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited.png",837,471,false],"thumbnail":["https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited-150x150.png",150,150,true],"medium":["https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited-300x169.png",300,169,true],"medium_large":["https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited-768x432.png",768,432,true],"large":["https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited.png",837,471,false],"1536x1536":["https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited.png",837,471,false],"2048x2048":["https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited.png",837,471,false],"woocommerce_thumbnail":["https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited-300x300.png",300,300,true],"woocommerce_single":["https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited.png",600,338,false],"woocommerce_gallery_thumbnail":["https:\/\/www.directimpactsolutions.com\/wp-content\/uploads\/2022\/08\/age-1-edited-100x100.png",100,100,true]},"uagb_author_info":{"display_name":"Nicole Morales","author_link":"https:\/\/www.directimpactsolutions.com\/en\/author\/nicole-morales\/"},"uagb_comment_info":0,"uagb_excerpt":"What is a custom function? Custom FileMaker functions are functions defined by the developer that can be reused anywhere in the database file in which they are created.\u00a0As developers, we can find ourselves evaluating a calculation multiple times, which is a great sign to use a custom function. A great resource for custom functions is&hellip;","_links":{"self":[{"href":"https:\/\/www.directimpactsolutions.com\/en\/wp-json\/wp\/v2\/posts\/7690","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.directimpactsolutions.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.directimpactsolutions.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.directimpactsolutions.com\/en\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.directimpactsolutions.com\/en\/wp-json\/wp\/v2\/comments?post=7690"}],"version-history":[{"count":26,"href":"https:\/\/www.directimpactsolutions.com\/en\/wp-json\/wp\/v2\/posts\/7690\/revisions"}],"predecessor-version":[{"id":19999,"href":"https:\/\/www.directimpactsolutions.com\/en\/wp-json\/wp\/v2\/posts\/7690\/revisions\/19999"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.directimpactsolutions.com\/en\/wp-json\/wp\/v2\/media\/7731"}],"wp:attachment":[{"href":"https:\/\/www.directimpactsolutions.com\/en\/wp-json\/wp\/v2\/media?parent=7690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.directimpactsolutions.com\/en\/wp-json\/wp\/v2\/categories?post=7690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.directimpactsolutions.com\/en\/wp-json\/wp\/v2\/tags?post=7690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}