{"id":97,"date":"2015-09-08T18:37:12","date_gmt":"2015-09-09T01:37:12","guid":{"rendered":"https:\/\/app.works\/?p=97"},"modified":"2022-08-03T09:58:49","modified_gmt":"2022-08-03T16:58:49","slug":"automatically-perform-script-on-server","status":"publish","type":"post","link":"https:\/\/App.Works\/automatically-perform-script-on-server\/","title":{"rendered":"Perform Script on Server Automatically"},"content":{"rendered":"<p>The ability of FileMaker Pro to <a href=\"https:\/\/fmhelp.filemaker.com\/help\/13\/fmp\/en\/html\/scripts_ref1.36.3.html#:~:text=Perform%20Script%20On%20Server&amp;text=Performs%20a%20script%20on%20the%20server%20that%20is%20hosting%20the%20current%20file.&amp;text=To%20select%20a%20script%2C%20click,build%20a%20more%20complex%20parameter.\">perform a script on the server<\/a> instead of locally on the client&#8217;s machine is a huge potential boon for productivity. Tasks for which a user might otherwise have to wait to complete can be accomplished in the background without causing a delay. Performing certain scripted tasks on the server is also much, much faster in many cases. So, it&#8217;s nice to perform a script on the server whenever you can.<\/p>\n<p><!--more--><\/p>\n<h2>Conditions Needed for PSoS<\/h2>\n<p>Of course, you can&#8217;t use &#8220;Perform Script on Server&#8221; (PSoS) if you don&#8217;t have the following three conditions present:<\/p>\n<ol>\n<li>You have to be running a <a href=\"https:\/\/app.works\/what-we-do\/hosting2\/\">hosted FileMaker<\/a> database<\/li>\n<li>The server that hosts it must support PSoS (v13 or v14)<\/li>\n<li>The script has to be compatible with PSoS (and set up to run that way)<\/li>\n<\/ol>\n<p>While working on our second FileMaker module, <a href=\"https:\/\/app.works\/product\/fmrecent-records\/\">fmRecentRecords<\/a>, we perfected a neat scripting trick for automatically running a script on a server, whenever possible. The specific code is shown below, but it basically works this way:<\/p>\n<p>First, the script needs to determine if the file is actually hosted (using Get (ConnectionState) ). Next, it needs to determine what version of FileMaker Server is hosting the file (using Get (HostApplicationVersion) ), and if that version is one that can handle PSoS (using PatternCount to look for the version numbers we require: 13 or 14). Once it&#8217;s determined that the file is <a href=\"https:\/\/app.works\/what-we-do\/hosting\/\">hosted by a version of FileMaker<\/a> Server that can use PSoS, the script needs to know whether it is itself currently running on the local machine. If it is, then the script will recursevely call itself again using PSoS.<\/p>\n<p>Now the next time it runs (on the server), it will skip to the actual steps of the script we want to perform. If the file is not hosted, or is not hosted by a version 13 or higher server, then it will also skip the steps to call itself via PSoS, and the script just runs the rest of the procedure locally.<\/p>\n<p>The beauty of this is that you can use PSoS when it&#8217;s available, but still run just fine when it&#8217;s not. Check out the code below:<\/p>\n<p><a href=\"https:\/\/app.works\/wp-content\/uploads\/2016\/05\/screen_shot_2015-09-08_at_2.12.47_pm_720.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-98 size-full\" src=\"https:\/\/app.works\/wp-content\/uploads\/2016\/05\/screen_shot_2015-09-08_at_2.12.47_pm_720.png\" alt=\"FileMaker Perform Script on Server\" width=\"720\" height=\"520\" srcset=\"https:\/\/App.Works\/wp-content\/uploads\/2016\/05\/screen_shot_2015-09-08_at_2.12.47_pm_720.png 720w, https:\/\/App.Works\/wp-content\/uploads\/2016\/05\/screen_shot_2015-09-08_at_2.12.47_pm_720-600x433.png 600w, https:\/\/App.Works\/wp-content\/uploads\/2016\/05\/screen_shot_2015-09-08_at_2.12.47_pm_720-300x217.png 300w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>Just insert some code like this into your script and you&#8217;re off and running&#8230; <em>on server!<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The ability of FileMaker Pro to perform a script on the server instead of locally on the client&#8217;s machine is a huge potential boon for productivity. Tasks for which a user might otherwise have to wait to complete can be accomplished in the background without causing a delay.<\/p>\n","protected":false},"author":3,"featured_media":9654,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[40,31],"tags":[5,6,48,47,46],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>Perform Script on Server Automatically - AppWorks<\/title>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/App.Works\/automatically-perform-script-on-server\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"Perform Script on Server Automatically - AppWorks\" \/>\r\n<meta property=\"og:description\" content=\"The ability of FileMaker Pro to perform a script on the server instead of locally on the client&#039;s machine is a huge potential boon for productivity. Tasks for which a user might otherwise have to wait to complete can be accomplished in the background without causing a delay.\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/App.Works\/automatically-perform-script-on-server\/\" \/>\r\n<meta property=\"og:site_name\" content=\"AppWorks\" \/>\r\n<meta property=\"article:published_time\" content=\"2015-09-09T01:37:12+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2022-08-03T16:58:49+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/App.Works\/wp-content\/uploads\/2015\/09\/screen_shot_2015-09-08_at_2.12.47_pm_720.png\" \/>\r\n\t<meta property=\"og:image:width\" content=\"720\" \/>\r\n\t<meta property=\"og:image:height\" content=\"520\" \/>\r\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\r\n<meta name=\"author\" content=\"David Weiner\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"David Weiner\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/App.Works\/automatically-perform-script-on-server\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/App.Works\/automatically-perform-script-on-server\/\"},\"author\":{\"name\":\"David Weiner\",\"@id\":\"https:\/\/www.app.works\/#\/schema\/person\/0c5cb68330194506c5004648d61c7bb9\"},\"headline\":\"Perform Script on Server Automatically\",\"datePublished\":\"2015-09-09T01:37:12+00:00\",\"dateModified\":\"2022-08-03T16:58:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/App.Works\/automatically-perform-script-on-server\/\"},\"wordCount\":378,\"publisher\":{\"@id\":\"https:\/\/www.app.works\/#organization\"},\"keywords\":[\"Filemaker\",\"FileMaker 14\",\"FileMaker Techniques\",\"Perform Script on Server\",\"PSoS\"],\"articleSection\":[\"Blog\",\"FileMaker Techniques\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/App.Works\/automatically-perform-script-on-server\/\",\"url\":\"https:\/\/App.Works\/automatically-perform-script-on-server\/\",\"name\":\"Perform Script on Server Automatically - AppWorks\",\"isPartOf\":{\"@id\":\"https:\/\/www.app.works\/#website\"},\"datePublished\":\"2015-09-09T01:37:12+00:00\",\"dateModified\":\"2022-08-03T16:58:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/App.Works\/automatically-perform-script-on-server\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/App.Works\/automatically-perform-script-on-server\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/App.Works\/automatically-perform-script-on-server\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.app.works\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Perform Script on Server Automatically\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.app.works\/#website\",\"url\":\"https:\/\/www.app.works\/\",\"name\":\"AppWorks\",\"description\":\"Designing Smart Apps Geared to Work for You\",\"publisher\":{\"@id\":\"https:\/\/www.app.works\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.app.works\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.app.works\/#organization\",\"name\":\"AppWorks\",\"url\":\"https:\/\/www.app.works\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.app.works\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/App.Works\/wp-content\/uploads\/2021\/02\/cropped-logo-aw-dis-big-1.png\",\"contentUrl\":\"https:\/\/App.Works\/wp-content\/uploads\/2021\/02\/cropped-logo-aw-dis-big-1.png\",\"width\":175,\"height\":67,\"caption\":\"AppWorks\"},\"image\":{\"@id\":\"https:\/\/www.app.works\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.app.works\/#\/schema\/person\/0c5cb68330194506c5004648d61c7bb9\",\"name\":\"David Weiner\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.app.works\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ed007952be47a6c0207223f1268e08af?s=96&d=identicon&r=pg\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ed007952be47a6c0207223f1268e08af?s=96&d=identicon&r=pg\",\"caption\":\"David Weiner\"},\"url\":\"https:\/\/App.Works\/author\/davidjweiner\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Perform Script on Server Automatically - AppWorks","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/App.Works\/automatically-perform-script-on-server\/","og_locale":"en_US","og_type":"article","og_title":"Perform Script on Server Automatically - AppWorks","og_description":"The ability of FileMaker Pro to perform a script on the server instead of locally on the client's machine is a huge potential boon for productivity. Tasks for which a user might otherwise have to wait to complete can be accomplished in the background without causing a delay.","og_url":"https:\/\/App.Works\/automatically-perform-script-on-server\/","og_site_name":"AppWorks","article_published_time":"2015-09-09T01:37:12+00:00","article_modified_time":"2022-08-03T16:58:49+00:00","og_image":[{"width":720,"height":520,"url":"https:\/\/App.Works\/wp-content\/uploads\/2015\/09\/screen_shot_2015-09-08_at_2.12.47_pm_720.png","type":"image\/png"}],"author":"David Weiner","twitter_card":"summary_large_image","twitter_misc":{"Written by":"David Weiner","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/App.Works\/automatically-perform-script-on-server\/#article","isPartOf":{"@id":"https:\/\/App.Works\/automatically-perform-script-on-server\/"},"author":{"name":"David Weiner","@id":"https:\/\/www.app.works\/#\/schema\/person\/0c5cb68330194506c5004648d61c7bb9"},"headline":"Perform Script on Server Automatically","datePublished":"2015-09-09T01:37:12+00:00","dateModified":"2022-08-03T16:58:49+00:00","mainEntityOfPage":{"@id":"https:\/\/App.Works\/automatically-perform-script-on-server\/"},"wordCount":378,"publisher":{"@id":"https:\/\/www.app.works\/#organization"},"keywords":["Filemaker","FileMaker 14","FileMaker Techniques","Perform Script on Server","PSoS"],"articleSection":["Blog","FileMaker Techniques"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/App.Works\/automatically-perform-script-on-server\/","url":"https:\/\/App.Works\/automatically-perform-script-on-server\/","name":"Perform Script on Server Automatically - AppWorks","isPartOf":{"@id":"https:\/\/www.app.works\/#website"},"datePublished":"2015-09-09T01:37:12+00:00","dateModified":"2022-08-03T16:58:49+00:00","breadcrumb":{"@id":"https:\/\/App.Works\/automatically-perform-script-on-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/App.Works\/automatically-perform-script-on-server\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/App.Works\/automatically-perform-script-on-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.app.works\/"},{"@type":"ListItem","position":2,"name":"Perform Script on Server Automatically"}]},{"@type":"WebSite","@id":"https:\/\/www.app.works\/#website","url":"https:\/\/www.app.works\/","name":"AppWorks","description":"Designing Smart Apps Geared to Work for You","publisher":{"@id":"https:\/\/www.app.works\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.app.works\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.app.works\/#organization","name":"AppWorks","url":"https:\/\/www.app.works\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.app.works\/#\/schema\/logo\/image\/","url":"https:\/\/App.Works\/wp-content\/uploads\/2021\/02\/cropped-logo-aw-dis-big-1.png","contentUrl":"https:\/\/App.Works\/wp-content\/uploads\/2021\/02\/cropped-logo-aw-dis-big-1.png","width":175,"height":67,"caption":"AppWorks"},"image":{"@id":"https:\/\/www.app.works\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.app.works\/#\/schema\/person\/0c5cb68330194506c5004648d61c7bb9","name":"David Weiner","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.app.works\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ed007952be47a6c0207223f1268e08af?s=96&d=identicon&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ed007952be47a6c0207223f1268e08af?s=96&d=identicon&r=pg","caption":"David Weiner"},"url":"https:\/\/App.Works\/author\/davidjweiner\/"}]}},"_links":{"self":[{"href":"https:\/\/App.Works\/wp-json\/wp\/v2\/posts\/97"}],"collection":[{"href":"https:\/\/App.Works\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/App.Works\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/App.Works\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/App.Works\/wp-json\/wp\/v2\/comments?post=97"}],"version-history":[{"count":7,"href":"https:\/\/App.Works\/wp-json\/wp\/v2\/posts\/97\/revisions"}],"predecessor-version":[{"id":9659,"href":"https:\/\/App.Works\/wp-json\/wp\/v2\/posts\/97\/revisions\/9659"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/App.Works\/wp-json\/wp\/v2\/media\/9654"}],"wp:attachment":[{"href":"https:\/\/App.Works\/wp-json\/wp\/v2\/media?parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/App.Works\/wp-json\/wp\/v2\/categories?post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/App.Works\/wp-json\/wp\/v2\/tags?post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}