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

Issue finding text in email body

Hello,

 

I'm trying to use Flow to extrac some information from an email body but I'm encountering a very unusual problem when trying to extract part of a title between two placeholders;

 

1) I convert the body of the email to text using the HTML to Text conversion

2) I look for the first placeholder text before the text I want to extract using;

        a) add(indexof(body('Html_to_text'),'Short Description = '),20) - The 20 gives me the end character of the string rather than                  start
3) I look for the placeholder text at the end of the text I want to extract using;
       b) indexOf(body('Html_to_text'),'Customer')
4) I then look for the text between the two placeholders using;
      c) substring(body('Html_to_text'),variables('TitleStart'),variables('TitleEnd'))
 
The issue is, the start character formula returns 232 which correctly gives me the start of the title I want to search for, the end character formula returns 271 which gives a 39 character long string in the middle which is correct, however the output of the last function which should give a string between characters 232 and 271 (39 chars) actually gives a string that is 262 characters long. I can't understand why this is, as the function simply asks for a substring of the email body from chars 232 to 271. The start position of the text string is correct, but the string goes on too long and doesn't stop. 
 
Has anyone encountered this problem before? Does anyone know how to resolve this? I've manipulated text many times in flow and never encountered this problem before
 
Thanks
Chris
 
 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper I
Helper I

Re: Issue finding text in email body

Sorry! I just realised the problem, the substring function asks for a length at the end, not the end character number. I can't figure out how to delete this question now!

 

View solution in original post

2 REPLIES 2
Highlighted
Helper I
Helper I

Re: Issue finding text in email body

Sorry! I just realised the problem, the substring function asks for a length at the end, not the end character number. I can't figure out how to delete this question now!

 

View solution in original post

Highlighted
Super User II
Super User II

Re: Issue finding text in email body

@chrisingham  Just mark it  completed 🙂 

 

-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (6,395)