Counter for emails + Timestamp for beginning of process and end of process

hello Developers

I need some help. I have created a process(print screen below) that finds unread emails, reads the body of email, Parse some items from body of emails. I set a condition that separates “good emails” from “bad emails”.

What I’m looking for at the end of the entire process I need to identify how many total unread emails were in the inbox, and out of those unread emails how many were “good” and how many were “bad”. I need the output to state something similar below. Please note that this output will be sent out to different parties.

On “date” there were a total of 10 unread emails. 5 of those were “good emails”. 5 of those were "bad. Process was started at “time” and ended at "time

Does anyone have any ideas how this can be accomplish? Any assistance will be appreciated.

image

What’s the condition to make it good or bad? You can use a LINQ expression to separate the list of mailmessages from the Get Outlook Mail Messages output. The below expression will return an integer representing the total messages that meet the criteria where subject = “good email”

messages.where(Function(email) email.subject = "good email").Count

For the total unread messages, check the box for the property in Get Outlook messages called OnlyUnreadMessages. Then you can use messages.count

For the start and end time, create a variable called startTime and endTime, both of type System.dateTime. Then use an assign activity at the beginning of the workflow, setting startTime = now. Do the same using endTime and place at the end of the workflow

Greg,

here is the condition I wrote:
image

good email goes through process
image

Bad email goes to Else
image

In that case, let’s do something else for the good and bad counts.

Create 2 variables of type Int32, named goodCount and badCount. Set both variable’s default values to zero, and set the scope as broadly as possible.

In your if statement that decides good or bad, use an assign activity to increase the goodCount or badCount variable.

So on each side of the if statement, put goodCount = goodCount + 1 and badCount = badCount + 1.

That will give you the totals on each side at the end of the loop.

It should look something like this:

Greg,
I already had the box checked
image

I created the message box, which gave me the count.
image

image

How do separate the good from bad? AND how do I list them at the end of the process?

disregard my last email. I just saw your reply along with the picture. let me give it a try.

Sounds good, let me know. Just make sure your message box is after/outside the For Loop