I started off with using compose but Im getting this error on test so I tried variable but wasn't helpful, you guys have any idea where I might have overlooked things?
substring(variables('TxtEmailBody'),indexOf(variables('TxtEmailBody')),variables('DomainName'),9)
Thanks in advance!
Solved! Go to Solution.
Hi @Player1 ,
Please try the following configuration and expression:
trim(split(split(outputs('Html_to_text')?['body'],'date')[1],'domain')[0])
Feel free to let us know if you have any questions about this method.
Best Regards,
Hi @Player1
I think you have too many parameters.
The substring needs 3 parameters:
1. text: string
2. startIndex: integer
3. length?: integer
You have the variables('DomainName') that is a, I supose, a string and then a 9 so you have 4 parameters.
What do you want to do with variables('DomainName')?
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Cheers
Manuel
Thanks for the quick response @manuelstgomes, I though it won't let me save the flow if I have too much parameters and though that I have the right parameters in place:
Hi @Player1 ,
Could you provide us with sample data of the email body so that we can provide you with a suitable expression to extract the specified data?
Does the content of the Email body have a fixed format? Please consider following these similar threads and see if it helps:
Solved: Extracting text from email - Power Platform Community
Solved: Extract text from body of an email and create new ... - Power Platform Community
Best Regards,
HI @Player1
The indexOf is not what you present in your graphic. Check the parenthesis. Here's the start and end of the indexOf.
That's why you get the error. You have four parameters and not 3.
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Cheers
Manuel
Hi @v-bacao-msft this is how the email body looks like after converting it to txt, my goal on this expression is to get the 9 digit number on it:
date
234234354
domain[.]net
This domain does not resolve
astrata
2020-08-03
I split it previously and got the 'domain' as dynamic content.
Hi @Player1 ,
Please try the following configuration and expression:
trim(split(split(outputs('Html_to_text')?['body'],'date')[1],'domain')[0])
Feel free to let us know if you have any questions about this method.
Best Regards,
Hi @v-bacao-msft and @manuelstgomes,
Thank you very much for your inputs and apologies for not responding back quickly but playing around with with flow and what I was trying to achieve have made me realize that my original concept was not reliable if I receive multiple data that I would like to extract/match on a single email body. Hence keep at it and found a more robust approach to go about it and its by using regex to match the data that I want, with patterns.
This might be outside the context and subject of my original post but would like to give an update on my journey with power automate as people might be in a similar position. So I receive these emails and its the trigger of my flow converting them from html to text this is how they look:
Registration date
123456789
blog[.]domain[.]fm
2020-08-09
223456789
domain[.]de
2020-08-09
now the data that is relevant to me is the nine digit ticket number and their domains. I'm able to parse and match them using plumsail match regular expression:
\d{9}|(?<=\d{9}\n\n)\w.*
the first part \d{9} matches the nine digit ticket number that I need and the | is OR operation and the last part (?<=\d{9}\n\n)\w.* is matching the domain reported and gives me an output:
[
{
"Match0": "123456789"
},
{
"Match0": "blog[.]domain[.]fm"
},
{
"Match0": "223456789"
},
{
"Match0": "domain[.]de"
}
]
The problem Im getting now is to actually use the data that I'm matching. As each ticket number and domain are a new match0 using it on apply for each is proving harder than advertised because I want to edit a list that has the Domain with the corresponding TicketNumber in a single row, this is how the data structure of the list looks like:
I tried the named groups which looks easy in some post using the following regex:
TicketNumber: (?<TicketNumber>\d{9})
Domain: (?<Domain>(?<=\d{9}\n\n)\w.*)
But I'm not getting any matches with this expression and returning as false.
User | Count |
---|---|
89 | |
37 | |
26 | |
13 | |
12 |
User | Count |
---|---|
127 | |
54 | |
38 | |
26 | |
21 |