cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mark-carlisle
Level: Powered On

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 Team
Community Support Team

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 Team
Community Support Team

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

mark-carlisle
Level: Powered On

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

That worked great.

 

Thanks

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 327 members 5,488 guests
Please welcome our newest community members: