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

Find the length of a string to use in substring

I want to extract information from the body of an email and populate fields in a SharePoint. An extract of the email is follows;

 

Details

------------------------------------------------------------

Account Number 99999999

Contact Name Mr A N Other

Email example@domain.com

Telephone 0123456789

Incident Reference XXXXX-XXXXX


I've solved the fixed length data but I'm having issues with the varaible length data like Email. The expression I am using is;

 

substring(body('Html_to_text'),add(lastIndexOf(body('Html_to_text'),'Email ', 6),X)

Where 'X' will be the length of the email address which is where I'm struggling to find a way to find the length of a string.

 

Any suggestions would be appreciated.Capture.PNG

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: Find the length of a string to use in substring

Hi @mark-carlisle,

 

Would it be available to take use of the LastIndexof function here?

 

For example, if here you would like to get the Email length, then we could write the formula as this:

Sub(
LastIndexOf(body('Html_to_text'), 'Telephone'),
Add(LastIndexOf(body('Html_to_text'),'Email '), 6)
)

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support
Community Support

Re: Find the length of a string to use in substring

Hi @mark-carlisle,

 

Would it be available to take use of the LastIndexof function here?

 

For example, if here you would like to get the Email length, then we could write the formula as this:

Sub(
LastIndexOf(body('Html_to_text'), 'Telephone'),
Add(LastIndexOf(body('Html_to_text'),'Email '), 6)
)

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Helper II
Helper II

Re: Find the length of a string to use in substring

That worked great.

 

Thanks

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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!

Top Solution Authors
Top Kudoed Authors
Users online (7,227)