cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Getting specific lines from File Content to insert in E-Mail Subject

Hey there,

im struggling a little bit with this topic. (Subject)

 

Right now my Flow is doing almost how I want it to, but now a Number which is inside of the File Content needs to be integrated into the E-Mail Subject line to make the analyzing of the document easier for my colleagues.

My Flow looks currently as following:

PatrickAllers_0-1600850144918.png

PatrickAllers_1-1600850177177.png

PatrickAllers_2-1600850258794.png

 

 

So in conclusion: I basically want to get a specific line (IMO Number) inside of the File Content of "Information-File.txt" to attach that Line to the Subject (the Number is different in every document) But I don't know how to start with it.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: Getting specific lines from File Content to insert in E-Mail Subject

Hi again!

Now try with this

first(split(last(split(outputs('Compose'),'IMO Number:')),'
'))

Please note I hit Enter key on my keyboard just between the two final single quotes

 

If this approach does not work, I would try with

first(split(last(split(outputs('Compose'),'IMO Number:')),' '))

If it does not work either, my next question would be:  does the data you need to extract always have the same number of digits (7)?

Thanx!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

6 REPLIES 6
Highlighted
Dual Super User III
Dual Super User III

Re: Getting specific lines from File Content to insert in E-Mail Subject

Hi!

I would add a dummy Compose action block just after 'Get file content' assign as its input 'Get file content output', reexecute the flow and inspect 'Compose' outputs so you would be able to see the txt file in plain text.

Once this is working as expected, we need you to share an example of the text file content.

It is common to use split() WDL function to grab information, assuming:

  • the text structure remains the same,
  • there are two patterns we can use to delimit the target data to be extracted, one just before and one just after it
  • the pattern just before your target data is present just once on your text

As an example, let's assume all your txt files contains the following structure:

 

IMO Number: xxx

Destination: yyy

 

If you need to extract xxx, you can use the following expression:

trim(first(split(last(split(outputs('Compose'),'IMO Number:')),'Destination:')))

 

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
New Member

Re: Getting specific lines from File Content to insert in E-Mail Subject

Hi!

 

Composing the File Content worked I guess.

PatrickAllers_0-1600867896926.png

 

Now I'll need a little guidance on how to grab the IMO Number which is shown here and insert that in the subject line.

 

Oh and yea, the Textfiles will always have the same structure.

Thanks in advance! 🙂

Highlighted
Dual Super User III
Dual Super User III

Re: Getting specific lines from File Content to insert in E-Mail Subject

Hi!

So closer to a happy ending, right?

 

I would try with the following expression just for testing purposes:

last(split(outputs('Compose'),'IMO Number:'))

 Now, reexecute the flow and share the text obtained through this expression. I expect it not the required one, but almost

Thanx!

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
New Member

Re: Getting specific lines from File Content to insert in E-Mail Subject

Hey there,

 

we're getting closer.

It took the Number in the subject line but everything else of the document as well 😄

PatrickAllers_0-1600870068266.png

 

Highlighted
Dual Super User III
Dual Super User III

Re: Getting specific lines from File Content to insert in E-Mail Subject

Hi again!

Now try with this

first(split(last(split(outputs('Compose'),'IMO Number:')),'
'))

Please note I hit Enter key on my keyboard just between the two final single quotes

 

If this approach does not work, I would try with

first(split(last(split(outputs('Compose'),'IMO Number:')),' '))

If it does not work either, my next question would be:  does the data you need to extract always have the same number of digits (7)?

Thanx!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

Highlighted
New Member

Re: Getting specific lines from File Content to insert in E-Mail Subject

Hey!

 

The first one worked perfectly fine, thank you very much! 🙂

Now the mails are going out exactly how I want to.

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.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,777)