{"id":31,"date":"2024-09-06T10:03:52","date_gmt":"2024-09-06T17:03:52","guid":{"rendered":"https:\/\/gilosoftblogcom.wordpress.com\/?p=31"},"modified":"2024-09-06T10:03:52","modified_gmt":"2024-09-06T17:03:52","slug":"using-length-function-in-power-automate","status":"publish","type":"post","link":"https:\/\/blog.gilosoft.com\/index.php\/2024\/09\/06\/using-length-function-in-power-automate\/","title":{"rendered":"Using Length Function in Power Automate"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">There are many text functions that can be used in Power Automate to modify string functions. In this article we will be going over what the length function is and how to use it in Power Automate.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What is the Length Function?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Power Automate length function returns the length of a string or the length of an array.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Syntax<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlength('&lt;collection&gt;')\nlength(&#x5B;&lt;collection&gt;])\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Step-by-Step guide to using length function<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1:<\/strong> Create A New Flow (make.powerautomate.com)<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/gilosoft.com\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-06-at-11.25.12%E2%80%AFAM-1024x650.png\" alt=\"\" class=\"wp-image-2410\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 2:<\/strong> Use initialize variable to create a string<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/gilosoft.com\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-07-at-11.35.30%E2%80%AFAM-1024x450.png\" alt=\"\" class=\"wp-image-2411\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 3:<\/strong> Add a compose action card to hold the length function expression shown below:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The expression we will use is:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlength(variables('myString'))\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/gilosoft.com\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-07-at-11.38.55%E2%80%AFAM-1024x355.png\" alt=\"\" class=\"wp-image-2412\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 4:<\/strong> Add an array variable using the &#8216;initialize variable&#8217; action card with the following details:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/gilosoft.com\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-07-at-11.40.35%E2%80%AFAM-1024x335.png\" alt=\"\" class=\"wp-image-2415\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 5:<\/strong> Add a compose action card to hold the array variable with the following details:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The expression you will use is:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlength(variables('myArray'))\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/gilosoft.com\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-07-at-11.43.04%E2%80%AFAM-1-1024x314.png\" alt=\"\" class=\"wp-image-2416\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 6:<\/strong> Save and Test your flow. Your results should resemble the results I got from running the flow.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For the String:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/gilosoft.com\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-13-at-10.45.18%E2%80%AFAM-1024x804.png\" alt=\"\" class=\"wp-image-2417\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">For the Array:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/gilosoft.com\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-13-at-10.45.28%E2%80%AFAM-1024x804.png\" alt=\"\" class=\"wp-image-2418\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The length function as shown in the above steps is a very simple function that can be used to find the length of both strings and arrays. Though we have gone over very simple examples of its use, it can be used in more complex means such as data validation, conditional logic, and monitoring\/alerting scenarios.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Feel free to share your learnings with others and comment if you have any questions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are many text functions that can be used in Power Automate to modify string functions. In this article we will be going over what the length function is and how to use it in Power Automate. What is the Length Function? The Power Automate length function returns the length of a string or the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":33,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-31","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-power-automate-text-functions"],"_links":{"self":[{"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":0,"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/media\/33"}],"wp:attachment":[{"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}