cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
foaman
Frequent Visitor

Help with extraction code

I need to extract the most basic info from the body of an email.  The body will remain consistant in format.  I have tried numerous articles for help but just cant quite get this.  Using the split/join method my input and out put says "click to download"  its odd.  At any rate could some one help me extract these two pieces of info with either splits or WDL?

 

The email address will get used in the Approval process, the month is merely for reference in the SharePoint list.  

 

Approver: Firstname.Lastname@business.com

Month: November

2 ACCEPTED SOLUTIONS

Accepted Solutions
abm
Super User III
Super User III

Hi @foaman 

 

This is what you need to do. The first step I have a string which contained the email text. In your email this step might be different. That's fine.

 

email1.png

 

Second step is a compose statement. 

 

email2.png

 

Here my expression is as follows:

trim(first(split(last(split(variables('EmailContent'),'Approver: ')),'This is another line')))
 
For the above expression you need to split with 'Approver: ' and use the last function to include your very next line after the approver. So in my case it is called 'This is another line'. Please refer to my first step text message.
 
This is my test results.
email3.png
 
You can use the similar method to find the month as well. Change the split and last keywords appropriately.
 
If you need any further help please let me know.
 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

View solution in original post

v-alzhan-msft
Community Support
Community Support

Hi @foaman ,

 

Could you please share the full email body content?

Are the text"

Approver: Firstname.Lastname@business.com

Month: November

" the full email body content?

 

If yes, please refer to screenshot below to create the flow:

1.png

The expression in the Compose 2 as below:

last(split(first(split(outputs('Compose'),'Month: ')),'Approver: '))

The expression in the Compose 3 as below:

last(split(outputs('Compose'),'Month: '))

The flow would run successfully as below:

2.png

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
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

4 REPLIES 4
abm
Super User III
Super User III

Hi @foaman 

 

Not sure what you meant about extract the most basic info? Could you please explain with an example or post your flow screenshot.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
foaman
Frequent Visitor

by most basic i just mean two rows of info.  I need to extract the email address of varying lengths with one Compose expression and the Month with another.    Basically this 

https://powerusers.microsoft.com/t5/Building-Flows/Extract-text-from-Body-of-an-email-in-Flow/td-p/5...  or

https://powerusers.microsoft.com/t5/Building-Flows/Extracting-text-from-email/m-p/335540/highlight/t... 

but my email will always be formatted like this.

 

Approver: fn.ln@bix.com 

Month: May

 

On my cell phone now its hard to get pics i can provide later if needed.

abm
Super User III
Super User III

Hi @foaman 

 

This is what you need to do. The first step I have a string which contained the email text. In your email this step might be different. That's fine.

 

email1.png

 

Second step is a compose statement. 

 

email2.png

 

Here my expression is as follows:

trim(first(split(last(split(variables('EmailContent'),'Approver: ')),'This is another line')))
 
For the above expression you need to split with 'Approver: ' and use the last function to include your very next line after the approver. So in my case it is called 'This is another line'. Please refer to my first step text message.
 
This is my test results.
email3.png
 
You can use the similar method to find the month as well. Change the split and last keywords appropriately.
 
If you need any further help please let me know.
 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

View solution in original post

v-alzhan-msft
Community Support
Community Support

Hi @foaman ,

 

Could you please share the full email body content?

Are the text"

Approver: Firstname.Lastname@business.com

Month: November

" the full email body content?

 

If yes, please refer to screenshot below to create the flow:

1.png

The expression in the Compose 2 as below:

last(split(first(split(outputs('Compose'),'Month: ')),'Approver: '))

The expression in the Compose 3 as below:

last(split(outputs('Compose'),'Month: '))

The flow would run successfully as below:

2.png

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
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

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Kudoed Authors
Users online (3,364)