cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
p_doc
Helper III
Helper III

length of substring error invalid template.

Hi,

I am getting the following error, I am using only 2 variable which works on other flows.

Can someone please explain what does the below error mean?

I tried to push all the content through compose function, I cannot see anything wrong.

 

p_doc_0-1637820919900.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @p_doc,

 

In this example what are the startIndex and length parameters of your substring? 

 

Let say your string value is 11 characters. When you use a startIndex of 3 and a length of 11 in the substring function you will get a sum of 14, which exceeds the 11 character length of the string value.

 

Below is an example to demonstrate this.

 

helloworld_substringerror.png

 

helloworlderror.png

 

 

Make sure that the sum from adding the startIndex and length parameter values is less than the length of the string that you provide for the text parameter. Otherwise, you get an error, unlike similar functions in other languages where the result is the substring from the startIndex to the end of the string. The length parameter is optional and if not provided, the substring() function takes all the characters beginning from startIndex to the end of the string.

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#s...

 

View solution in original post

1 REPLY 1
Expiscornovus
Super User
Super User

Hi @p_doc,

 

In this example what are the startIndex and length parameters of your substring? 

 

Let say your string value is 11 characters. When you use a startIndex of 3 and a length of 11 in the substring function you will get a sum of 14, which exceeds the 11 character length of the string value.

 

Below is an example to demonstrate this.

 

helloworld_substringerror.png

 

helloworlderror.png

 

 

Make sure that the sum from adding the startIndex and length parameter values is less than the length of the string that you provide for the text parameter. Otherwise, you get an error, unlike similar functions in other languages where the result is the substring from the startIndex to the end of the string. The length parameter is optional and if not provided, the substring() function takes all the characters beginning from startIndex to the end of the string.

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#s...

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Users online (1,363)