Skip to main content

I have a workflow that basically kicks off a stored procedure to run after an ETL tool drops items into a database staging table.  Part of the workflow counts the number of items added to the actual work items table from the staging table.  I have it scheduled to run once per hour. It works well.

 

Unfortunately, sometimes the ETL fails or has an issue and the workflow will happily write 0 items to the work items table because it doesn't know any better.

 

I'd like to set up a a path in the workflow that if 0 items get written, it sends me an email letting me know.  

 

As the workflow runs once an hour (even after business hours) and I do NOT want it to send me an email on any 0 items written instance between say 6pm and 7am the next morning, I'd like to put as part of the line rule for it to only execute the email action when the time is between 6pm and 7am.   I'm sure that's possible via an expression but I'm having a hard time coming up with it.  (I'm not great with expressions at all).  

 

So, how do I write an expression (or maybe not an expression if there's an easier way) to say the specific hours of 6pm and 7am?  Thoughts?

 

Rob

 

 

 

 

Hello Robert,


 


Is this in K2 Studio or K2 Designer? It shouldn't matter too much, as both can do this.


 


We can use the Now expression to get what the current time is. It can be found under the Date expression.  Then we can just compare this against the times you mentioned. 


 


It will look something like this for our Line Rule.


 


If Now > Start Time Data Field


and Now < 7:00


Then go down the not send email path. 


 


If Now < 18:00


and Now > 7:00.


Then go down the send email event.


 


However, I seem having an issue getting it to just focus on the time of day, but it wants me to provide a date as well. I will see if I can get something that wil work.


 


 


Awesome.  That gives me something to think about. 

 

I was finding the date as part of the "NOW" also problematic.  It doesn't seem to have just a time function as opposed to a date.

 

I'll play around with this more, though.  :)

 

Rob

 

 

 


Reply