{"id":56,"date":"2012-02-14T10:23:11","date_gmt":"2012-02-14T16:23:11","guid":{"rendered":"http:\/\/www.teamdesk.net\/blog\/2012\/02\/extensions-to-formula-functions\/"},"modified":"2012-02-14T10:23:11","modified_gmt":"2012-02-14T16:23:11","slug":"extensions-to-formula-functions","status":"publish","type":"post","link":"https:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/","title":{"rendered":"Extensions to formula functions"},"content":{"rendered":"<p>Today we&#39;ve added couple of extensions to formula functions.<\/p>\n<p><strong><em>URLs<\/em><\/strong><\/p>\n<ol>\n<li><strong>URLEncode(text)<\/strong> is now aware of international characters and escapes them using UTF-8 most sites expect in the URL. <\/li>\n<li><strong>URLDecode(text)<\/strong> function performs decoding of URL parameters containing UTF-8 characters. This function is a counterpart of URLEncode() <\/li>\n<li><strong>URLParam(url, param)<\/strong> function extracts and decodes the value of the parameter specified by name from URL&#39;s query string. If there is no such parameter, NULL is returned. If there are multiple parameters under the same name, their values are concatenated in a comma-separated string. For example:\n<p>URLParam(&quot;google.com?q=teamdesk&quot;, &quot;q&quot;) = &quot;teamdesk&quot; <\/li>\n<li><strong>URLParam(url, param, index)<\/strong> function helps dealing with identically named parameters. If there are many, you can retrieve parameter&#39;s value by its name and 1-based index.\n<p>URLParam(&quot;google.com?q=teamdesk&amp;q=&quot;dbflex&quot;, &quot;q&quot;, 2) = &quot;dbflex&quot; <\/li>\n<\/ol>\n<p><strong><em>Formatting<\/em><\/strong><\/p>\n<blockquote>\n<p><strong>Format(date, fmt)<\/strong>, <strong>Format(time, fmt)<\/strong> and <strong>Format(timestamp, fmt)<\/strong> support a number of additional <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/az4se3k1(v=vs.80).aspx\" target=\"_blank\">standard<\/a> and <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/8kb3ddd4(v=vs.80).aspx\" target=\"_blank\">custom<\/a> formatting patterns. For example,       <\/p>\n<p>Format(#2012-02-14#, &quot;MM\/yy&quot;) = &quot;02\/12&quot;<\/p>\n<\/blockquote>\n<p><strong><em>Padding<\/em><\/strong><\/p>\n<ol>\n<li><strong>PadLeft(string, width, filler)<\/strong> right-aligns the characters in the string by padding them with specified filler character on the left, for a specified total width. <\/li>\n<li><strong>PadRight(string, width, filler) <\/strong>left-aligns the characters in the string by padding them on the right with specified filler character, for a specified total width. <\/li>\n<\/ol>\n<blockquote>\n<p>In both function filler parameter is optional and defaults to space. If the width of the string exceeds specified width the string is not padded.<\/p>\n<\/blockquote>\n<p><strong><em>Checkboxes<\/em><\/strong><\/p>\n<blockquote>\n<p>Two new functions, <strong>All(values, list)<\/strong> and <strong>Any(values, list)<\/strong> will help you dealing with text columns with Choices option set to checkboxes. For these columns, the value is a comma-separated concatenated string of checked values.<\/p>\n<p>These two functions accept comma separated lists of values in both values and list arguments. First function checks that all values specified in its list argument exist in a values argument. Second function ensures that at least one value from list exists in values.<\/p>\n<p>That&#39;s, <strong>All(&quot;A,B,C,D&quot;, &quot;D,A&quot;)<\/strong> evaluates to <strong>true<\/strong>, while <strong>All(&quot;A,B,C,D&quot;, &quot;D,E&quot;)<\/strong> evaluates to <strong>false<\/strong> because of E is not present in A,B,C,D. In contrast, both <strong>Any(&quot;A,B,C,D&quot;, &quot;D,A&quot;)<\/strong> and <strong>Any(&quot;A,B,C,D&quot;, &quot;D,E&quot;)<\/strong> evaluate to <strong>true<\/strong> because there is at least D that is present in A,B,C,D.<\/p>\n<p>So, now the filter of the view that asks the user for checkbox column can be rewritten as simply as <strong>Ask(All([Text], [?Text]))<\/strong> or <strong>Ask(Any([Text], [?Text])) <\/strong>depending on a type of comparison you prefer.<\/p>\n<\/blockquote>\n<p><strong><em>Dates<\/em><\/strong><\/p>\n<blockquote>\n<p><strong>MonthsBetween(date, date)<\/strong>, <strong>QuartersBetween(date, date)<\/strong> and <strong>YearsBetween(date, date)<\/strong> return the number of boundaries [beginning of month, quarter, year] crossed between the specified dates. That&#39;s the result of MonthsBetween(#2012-01-01#, #2011-12-31#),       <br \/>QuartersBetween(#2012-01-01#, #2011-12-31#) and       <br \/>YearsBetween(#2012-01-01#, #2011-12-31#) is 1.<\/p>\n<\/blockquote>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today we&#39;ve added couple of extensions to formula functions. URLs URLEncode(text) is now aware of international characters and escapes them using UTF-8 most sites expect in the URL. URLDecode(text) function performs decoding of URL parameters containing UTF-8 characters. This function is a counterpart of URLEncode() URLParam(url, param) function extracts and decodes the value of the [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-56","post","type-post","status-publish","format-standard","hentry","category-whats-new"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Extensions to formula functions - TeamDesk Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Extensions to formula functions - TeamDesk Blog\" \/>\n<meta property=\"og:description\" content=\"Today we&#039;ve added couple of extensions to formula functions. URLs URLEncode(text) is now aware of international characters and escapes them using UTF-8 most sites expect in the URL. URLDecode(text) function performs decoding of URL parameters containing UTF-8 characters. This function is a counterpart of URLEncode() URLParam(url, param) function extracts and decodes the value of the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/\" \/>\n<meta property=\"og:site_name\" content=\"TeamDesk Blog\" \/>\n<meta property=\"article:published_time\" content=\"2012-02-14T16:23:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2024\/01\/logo_og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"315\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Kirill Bondar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirill Bondar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/whats-new\\\/extensions-to-formula-functions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/whats-new\\\/extensions-to-formula-functions\\\/\"},\"author\":{\"name\":\"Kirill Bondar\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/22c4c05bd657513c8b00122fa364c8d2\"},\"headline\":\"Extensions to formula functions\",\"datePublished\":\"2012-02-14T16:23:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/whats-new\\\/extensions-to-formula-functions\\\/\"},\"wordCount\":517,\"commentCount\":1,\"articleSection\":[\"What's New\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/whats-new\\\/extensions-to-formula-functions\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/whats-new\\\/extensions-to-formula-functions\\\/\",\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/whats-new\\\/extensions-to-formula-functions\\\/\",\"name\":\"Extensions to formula functions - TeamDesk Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#website\"},\"datePublished\":\"2012-02-14T16:23:11+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/22c4c05bd657513c8b00122fa364c8d2\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/whats-new\\\/extensions-to-formula-functions\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/whats-new\\\/extensions-to-formula-functions\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/whats-new\\\/extensions-to-formula-functions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Extensions to formula functions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/\",\"name\":\"TeamDesk Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/22c4c05bd657513c8b00122fa364c8d2\",\"name\":\"Kirill Bondar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g\",\"caption\":\"Kirill Bondar\"},\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/author\\\/kirill-bondar\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Extensions to formula functions - TeamDesk Blog","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:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/","og_locale":"en_US","og_type":"article","og_title":"Extensions to formula functions - TeamDesk Blog","og_description":"Today we&#39;ve added couple of extensions to formula functions. URLs URLEncode(text) is now aware of international characters and escapes them using UTF-8 most sites expect in the URL. URLDecode(text) function performs decoding of URL parameters containing UTF-8 characters. This function is a counterpart of URLEncode() URLParam(url, param) function extracts and decodes the value of the [&hellip;]","og_url":"https:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/","og_site_name":"TeamDesk Blog","article_published_time":"2012-02-14T16:23:11+00:00","og_image":[{"width":600,"height":315,"url":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2024\/01\/logo_og.png","type":"image\/png"}],"author":"Kirill Bondar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirill Bondar","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/#article","isPartOf":{"@id":"https:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/"},"author":{"name":"Kirill Bondar","@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/22c4c05bd657513c8b00122fa364c8d2"},"headline":"Extensions to formula functions","datePublished":"2012-02-14T16:23:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/"},"wordCount":517,"commentCount":1,"articleSection":["What's New"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/","url":"https:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/","name":"Extensions to formula functions - TeamDesk Blog","isPartOf":{"@id":"https:\/\/www.teamdesk.net\/blog\/#website"},"datePublished":"2012-02-14T16:23:11+00:00","author":{"@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/22c4c05bd657513c8b00122fa364c8d2"},"breadcrumb":{"@id":"https:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.teamdesk.net\/blog\/whats-new\/extensions-to-formula-functions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.teamdesk.net\/blog\/"},{"@type":"ListItem","position":2,"name":"Extensions to formula functions"}]},{"@type":"WebSite","@id":"https:\/\/www.teamdesk.net\/blog\/#website","url":"https:\/\/www.teamdesk.net\/blog\/","name":"TeamDesk Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.teamdesk.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/22c4c05bd657513c8b00122fa364c8d2","name":"Kirill Bondar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g","caption":"Kirill Bondar"},"url":"https:\/\/www.teamdesk.net\/blog\/author\/kirill-bondar\/"}]}},"_links":{"self":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts\/56","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/comments?post=56"}],"version-history":[{"count":0,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts\/56\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/media?parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/categories?post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/tags?post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}