The substring works if true but ....
It shouldn't even get to the substring statement since the result is false
Thank you in advance
Ok, I see whats wrong with your substring. The sum of the StartIndex and Legth is going to be greater than the total lenght of the string.
because you are asking for the IndexOf "toto-" and asking for exactly 15 characters after that we have to assume your string will always be longer than the sum of those two.
The easiest way to resolve this is to throw in a load of compose actions for each part of your expression. write out the "length" of your intial string. Another or the output of the indexOf, etc. You might find you need to start your substring at indexOf()+5 (the length of the toto- string). And also ensure there are 15 characters available in the full string for that to work. Also, bear in mind that when referencing your string in this way the position references are 0-based (so the start of the substring).. that means the first item is zero and the second character is 1... whereas the Length references are 1-based. Just to make everything REALLY confusing.
So.. take each atomic part of your expression. Write each bit out into a separate compose action and you should see where your numbers don't add up. Feel free to paste the output of the Compose actions here for us to help more.
By the way, the method isnt crashing, it's working perfectly!!
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!
We've given our badges an overhaul and also added some brand new ones!
Learn how to build the business apps that you need.
Find out where you can attend!
Watch & learn from the Power Automate Community Video Gallery!