Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

The length of substring can't be longer than '3' which is the length of the source string

(0) ShareShare
ReportReport
Posted on by 422

Hello All,

 

I am using below formula to cut my number string till 2 decimal places. 

float(substring(string(),0,add(indexof(string(),'.'),3)))
after inserting dynamic value 


substring(string('outputs('Create_item')?['body/Available_Hours']'),0,add(indexof(string('outputs('Create_item')?['body/Available_Hours']'),'.'),3))

 but for some records flow is failing with below error

SachinG31_0-1643183272822.png

Error: Unable to process template language expressions in action 'Send_an_email_(V2)_2' inputs at line '0' and column '0': 'The template language function 'substring' parameters are out of range: 'start index' and 'length' must be non-negative integers and their sum must be no larger than the length of the string. Please see 

my data value is generally like 

121.188590785908

103.997703585366

17.190887200542

 

  • kiranmai Profile Picture
    2 on at
    Re: The length of substring can't be longer than '3' which is the length of the source string

     

    Is there any function in Logic apps to check whether the file name has date or not ?

     Like in javascript, there is a function : "IsDate"

    My requirement is : If the file name has date included (F.e: example_validation_2021-09-02.csv) I should perform some operation

    If it doesnt have date in the file name (F.e: example_validation.csv ) no operation needs to be performed.

     

    These kind of files which doesnt have date included is blocking my work 😞 

     

    Please help me in this. 

    Many Thanks 

    🙂 

     

  • SachinG31 Profile Picture
    422 on at
    Re: The length of substring can't be longer than '3' which is the length of the source string

    Hello @v-JessicaG-msft , Yes you are right that was the reason why this error occurred. Thank you so much for all your efforts to analyze and solve this issue for me. 

    Now its working good. 😊 

  • Verified answer
    v-JessicaG-msft Profile Picture
    on at
    Re: The length of substring can't be longer than '3' which is the length of the source string

    Hi @SachinG31 ,

     

    The reason for this error should be that some values of the data value have less than two decimal places. You can use the "concat" function to add more decimals to the dynamic data value to avoid it.

    substring(string(concat('outputs('Create_item')?['body/Available_Hours']','000')),0,add(indexof(string(concat('outputs('Create_item')?['body/Available_Hours']','000')),'.'),3))

    I have a test for your reference, please refer to the screenshot:

    vJessicaGmsft_0-1643363451484.png

    vJessicaGmsft_1-1643363474938.png

    Best Regards,

    Jessica Gu

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1