
Hi ,
this is a continuation of yesterday's post.
what I'm trying to do is basically extract the Time and Date for an email that comes with two varying key phrases.
@Paulie78kindly helped with an awesome expression. So now, my flow works perfectly for both phrases (Proposed Start Time or Proposed Start Date) with this expression
if
(
greater(indexOf( outputs('Html_to_text')?['body'], 'Proposed Start Time:'), 0),
last(split(first(split(outputs('Html_to_text')?['body'],'MST')),'Proposed Start Time:')),
if
(
greater(indexOf( outputs('Html_to_text')?['body'], 'Proposed Start Date:'), 0),
last(split(first(split(outputs('Html_to_text')?['body'],'MST')),'Proposed Start Date:')),
'Not Found'
)
)
however, for the Proposed End Time or Proposed End date, I can't get to work
I'm using the following expression
if
(
greater(indexOf( outputs('Html_to_text')?['body'], 'Proposed End Time:'), 0),
last(split(first(split(outputs('Html_to_text')?['body'],'MST')),'Proposed End Time:')),
if
(
greater(indexOf( outputs('Html_to_text')?['body'], 'Proposed End Date:'), 0),
last(split(first(split(outputs('Html_to_text')?['body'],'MST')),'Proposed End Date:')),
'Not Found'
)
)
When an email with Proposed End Time comes I get this
then when an email with Proposed End Date I get Not Found
I know there's gotta be something incorrect with my expression, I just can't quite figure out what it is.
Any help with be greatly appreciated
I didn't really look at your expression so can't tell you what is wrong with it, but try this:
if
(
contains(outputs('Html_to_text')?['body'], 'Proposed Start Time:'),
'Start Time Found',
if
(
contains(outputs('Html_to_text')?['body'], 'Proposed Start Date:'),
'Start Date Found',
if
(
contains(outputs('Html_to_text')?['body'], 'Proposed End Time:'),
'Proposed End Time Found',
if
(
contains(outputs('Html_to_text')?['body'], 'Proposed End Date:'),
'Proposed End Date Found',
'Nothing found! What a shame'
)
)
)
)
This version is a bit easier to comprehend.
Put your substring expressions in where I have hard coded values such as "Start Time Found" etc.