web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / The length of substrin...
Power Automate
Unanswered

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

 

Categories:
I have the same question (0)
  • Verified answer
    v-JessicaG-msft Profile Picture
    on at

    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

     

  • SachinG31 Profile Picture
    422 on at

    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. 😊 

  • kiranmai Profile Picture
    2 on at

     

    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 

    🙂 

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard