cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Stewartjohn100
Advocate II
Advocate II

mid-substring ?

Hi to all, 

 

As a non-programmer, I I need some help in extracting specific data from the following fields, Name, Email, Persona Type etc.

 

What I've found is to use substring, but the way I am using it finds only a fixed portion of the inputted name, which may not always suit, and so I need to tweak that so it goes as far as the <br> shown in the 'html to text' data below.

 

This is what I found to extract the Name: 

substring(Body('Html_to_text'),add(IndexOf(Body('Html_to_text'),'Name : '), 7),12)

 


</style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Please find the access request details below <br>
<br>
<br>
Name : Lara Wire<br>
Email : <a href="mailto:lara.wire@test.com">lara.wire@test.com</a><br>
Persona Type : Global Sales<br>
Country : Germany<br>
Company Name : Global Sales Corporation<br>
Title : Support Automation Architect <br>
Phone Number : &#43;491823177123<br>
Request Access for : Sandbox, Production<br>
Justification for access : Need access for my job</p>
</div>

 

Many thanks in advance.

John

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @Stewartjohn100 

 

You could do this in different ways. Please see below.

 

abm_1-1572393944405.png

 

abm_2-1572393960142.png

Following are the expressions I used:

first(split(variables('subject'),'Email'))
last(split(outputs('Compose'),'Name : '))
replace(outputs('Compose_2'),'<br>', '')

 

Test Result:

 

abm_0-1572393891709.png

 



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 blog
Power Automate Video Tutorials

View solution in original post

3 REPLIES 3
abm
Super User
Super User

Hi @Stewartjohn100 

 

You could do this in different ways. Please see below.

 

abm_1-1572393944405.png

 

abm_2-1572393960142.png

Following are the expressions I used:

first(split(variables('subject'),'Email'))
last(split(outputs('Compose'),'Name : '))
replace(outputs('Compose_2'),'<br>', '')

 

Test Result:

 

abm_0-1572393891709.png

 



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 blog
Power Automate Video Tutorials

Many thanks @abm 

 

I did have trouble spotting that the 'Compose 2' became 'Compose_2' in the expression, but now that I've found that, I'm on my way.

Thanks so much!!

Hi again @abm 

 

wonder if you can help me once more..  the emails that are now arriving have changed (coming from another source), so I have in my 'Initialize Variable'

 

Name : Gerry Foxy </td>\r\n</tr>\r\n<tr>\r\n<td>
Email : gerry.foxy@abc.com</td>\r\n</tr>\r\n<tr>\r\n<td>

 

As a result I updated my Compose to 

replace(outputs('Compose_2'),'</td>\r\n</tr>\r\n<tr>\r\n<td>', '')  - but it does not replace anything.

 

The output of the Compose shows as 

Gerry Foxy </td>
</tr>
<tr>
<td>

 

so I updated the Compose to be 

replace(outputs('Compose_2'),'</td></tr><tr><td>', '')   and this does not work.

 

My latest attempt is to remove a single </td> - which does work, but I'd have to create 3 additional Compose replacements to get me to the name only. Any better method to achieve the end result of just the name 'Gerry Foxy'

 

Any advice appreciated.

Regards

Outfoxed 😑

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,430)