Hi there. I’m still new to UiPath and stumbling through things a bit.
I have a datatable that was pulled from a SQL query, then that data has been filtered and sorted by a specific column.
I need to check the most recent time stamp vs what the current system time is, and compare if the timestamp falls within the last 45 minutes of the current system time. That column format is “2/4/2020 16:02:20 PM”
Best route to go about that? If it falls within the 45 minutes of system time - then the robot will be done. If it doesn’t - then it will need to send an email (that part I’ve figured out on a previous email)
sort (descending) datatable on date column - use Sort Data Table activity. Name (Header) of the column goes to the Name is the activity’s properties. You can also use column index (starts from 0).
if now.AddMinutes(-45).ToString <= the top value in the sorted column, the value is with in the 45 minute range, else greater than 45 minutes
I don’t think that is correct though. It is comparing the current system time against a time stamp in an excel cell. I want to see if that time is within the last 45 minutes.
If it within the last 45 minutes, nothing will happen.
If it’s greater than 45 minutes - then it will send the email.
And that will need to be in an assign activity or will I need to do that as the condition in the Try/Else/Then? Gonna try both but want to make sure I understand clearly.
Sorry for the stupid question but, in the current “If statement” - it needs to go between the str_currentDate=str_RecentDropDate and the Now.AddMinutes(-45)?
I tried to replace it in the current expression to this -
and it’s giving me an error - "Argument no specified for parameter ‘s’ of ‘Public Shared Function ParseExact(s As String, format As String, provider As System.IFormatProvider) As Date’.
@supermanPunch - so this worked! I am getting a System Arguement Null Exception in my output log though. That string reference not set to an instance of a string?
There was no email that was sent though saying it fell outside of the 45 minutes. Makin’ traction here!!
@meggasaurus Can you use this: dt_RecentDropDate.Split(" "c)(1).ToString, inside a message box and show me the value , I want to know how the value appears from that , if it’s really in a Format suitable for DateTime.Parse