cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Axal
Level: Powered On

Error while Substring with Compose

Hi guys,

 

I created a Compose action to do a substring, but it returns an error which make me confuse what's wrong.

image.png

 

As pict above, the error suggest the parameter out of range, however if I look at the input, it does within the range.

 

My "Compose" expression is like this :

substring(variables('charServiceOrderNumber'),5,5)
whereby 'charServiceOrderNumber' is my variable from it previous step. The output value (as it captured in that picture)
is "IMWO00006" which substring start in position 5 and gets 5 char in length is exactly in range.
 
One curiosity also, the substring initially put as "substring(outputs('SetVarcharServiceNumber'),5,5) which refer to the step's name, but apparently Flow change it to "variables('charServiceOrderNumber')"
 
However, the main problem is what's wrong with the expression that returns the error ?
 
Can someone help me, please.
 
Thanks in advance,
Axal
 
 
 
 
 
 
 
 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Error while Substring with Compose

HI @Axal 

 

The issue is with the length of the string.

 

Your string has ten characters IMWO00006, but don't forget that the substring starts counting on position 0. So, you're starting at location 6 and adding 5 characters; it's returning an "out of range" or "I don't have enough characters to give you." Try instead of 5 using 4 and you'll get the intended result.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

1 REPLY 1
Super User
Super User

Re: Error while Substring with Compose

HI @Axal 

 

The issue is with the length of the string.

 

Your string has ten characters IMWO00006, but don't forget that the substring starts counting on position 0. So, you're starting at location 6 and adding 5 characters; it's returning an "out of range" or "I don't have enough characters to give you." Try instead of 5 using 4 and you'll get the intended result.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (5,693)