
Hello community!
I am trying to extract data from a email.
I use the HTML to TEXT conversion
The text is like this:
Some non relevant start info (dynamic in length)
Serial number: 180806168
Version: DF900 1.2.2
Modifications: 1 (0x0001)
Action: Modification
Some non relevant end text bla bla (dynamic as well)
I use the following COMPOSE to extract the data
For example serial number. This works ok!
trim(
substring(
body('Html_to_text'),
add(
indexOf(
body('Html_to_text'),
'Serial Number: '
),
14),
sub(
indexOf(
body('Html_to_text'),
'Version: '),
add(
indexOf(
body('Html_to_text'),
'Serial Number: '
),
14)
)
)
)
This will work for all but the last entry called ACTION:
I cannot count the characters because
Breaking my head over this, the only thing I can come up with is find the text until the next space or CRLF..
Or is it possible to declare the rest of the text without knowing what it will be....
Kind regards,
John
Hey there. Maybe consider the split() function instead. You could split everything on the ': ' and grab the array elements you want, and then split again on the carriage return ('\n' maybe??). Here's a quick video I did on normal strings like eMails, but could probably be applied to this. Then, it wouldn't matter what the header/keys were called...just where they were placed.
Keep us posted.
-Ed
If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.