Hi everyone!
I’m having trouble with an if condition activity for excel.
I have a column named “TIME” which is in time date type like “HH:mm:ss”.
I want to check if the time is bigger than 8 hours and if it is, to write in a cell if it’s “violated” or “not violated”
Can anyone help me out with this???
Suppose CellTime contains the data scraped from a cell of the spreadsheet.
Use an If activity with condition: CInt(CellTime.ToString.Split(":"c)(0) + CellTime.ToString.Split(":"c)(1) + CellTime.ToString.Split(":"c)(2)) > 80000. If it returns true, write “violated”, else “not violated” to the cell where you want this to be placed.
Step through the process in Debug mode, and find which value is throwing the error. If it is happening on the first entry, I want to see what time is set to in the Locals tab while you’re running the project in Debug mode just to be sure what data is in the variable. I have a suspicion that there is more to what’s in the field than what I can see in the spreadsheet.
The output message says “If: Index was outside the bounds of the array.”
And it shows the problem to be in the “if” activity.
condition.xaml (12.0 KB)
This is my axml file. It’s a little more complex than just the time thing, but I don’t have any issues with the other “if” activity. The excel file is exactly like the one above.
If you could take the time to help my out I’d appreciate it so much!
The condition is failing in the If statement because something unexpected happened when building the string using time.ToString.Split(":"c). Log this to the output and let us know what the messages say.
I like this solution, but please note that you need the package UiPath.Python to run this workflow. Not sure why, though, since the syntax just looks like Vb.Net.
Hi!
Thank you very much for taking the time to help me out. Both you and @Anthony_Humphries !
I’ve tried your .xaml and I think we’re almost there.
The entries of time are in the form of HH:mm:ss , so I think the “totalTime >= 28800” isn’t exactly right because I’m always getting the same result. Would you be so kind and have a look at it?
Thank you!
I’m uploading my version of the .xaml you’ve sent me 8hours calc_ver2.xaml (13.0 KB)