{"id":11,"date":"2024-09-04T13:29:23","date_gmt":"2024-09-04T20:29:23","guid":{"rendered":"https:\/\/gilosoftblogcom.wordpress.com\/2024\/09\/04\/beyond-the-obstacle\/"},"modified":"2024-09-04T13:29:23","modified_gmt":"2024-09-04T20:29:23","slug":"beyond-the-obstacle","status":"publish","type":"post","link":"https:\/\/blog.gilosoft.com\/index.php\/2024\/09\/04\/beyond-the-obstacle\/","title":{"rendered":"Using IndexOf function in Power Automate"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Power Automate is a powerful tool that can help admins and developers automate tasks and streamline workflows. One text function in power automate that can be used to help admins get a substring within a string of text is the indexOf function. In this blog we will be exploring this function and how you can utilize in a simple but effective manner.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First you must familiarize yourself with the indexOf function&#8217;s syntax as shown below:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nindexOf('&lt;text&gt;', '&lt;searchText&gt;')\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The results from the indexOf code are as follows:<br><br>The code will return a&nbsp;<strong>number greater or equal to zero<\/strong>&nbsp;if the search text is found in the text with &#8216;0&#8217; being the first place of the text.<br><br>If the &#8216;search text&#8217; is not found within the text it&nbsp;<strong>will return &#8216;-1&#8217;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step-by-Step simple example in Power Automate<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 1: Create A New instant cloud flow with a manual trigger.<\/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-23-at-10.29.41%E2%80%AFAM-1024x651.png\" alt=\"\" class=\"wp-image-2478\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Step 2: Add 2 parameters to your first action card as shown below:<\/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-23-at-10.22.12%E2%80%AFAM-1024x441.png\" alt=\"\" class=\"wp-image-2479\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Step 3: Add a compose action card to and use the following expression to utilize the indexOf function:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nindexOf(triggerBody()&#x5B;'text'],triggerBody()&#x5B;'text_1'])\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-23-at-10.23.36%E2%80%AFAM-1024x337.png\" alt=\"\" class=\"wp-image-2480\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Step 4: Save and Test your flow. Use any text in the parameters to test your indexOf function. Remember if you get &#8216;-1&#8217; as your output it will mean the text you are looking for cannot be found.<\/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-23-at-10.25.54%E2%80%AFAM-1.png\" alt=\"\" class=\"wp-image-2482\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/gilosoft.com\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-23-at-10.25.23%E2%80%AFAM-1024x648.png\" alt=\"\" class=\"wp-image-2483\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Challenges in business are a given, but it\u2019s our response to them that defines our trajectory. Looking beyond the immediate obstacle, there lies a realm of opportunity and learning.<\/p>\n","protected":false},"author":2,"featured_media":131,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-11","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\/11","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=11"}],"version-history":[{"count":0,"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/media\/131"}],"wp:attachment":[{"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.gilosoft.com\/index.php\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}