cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

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
Highlighted
Super User II
Super User II

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
Highlighted
Super User II
Super User II

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
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (8,808)