Excel to database, ignore and report exception rows?


#1

if we have 2 columns in an excel spread sheet, say

Name | Age
Dan | 23
Joe | 56
Simon | 73
56 | peter
Terry | 25

we can see peter has been entered incorrectly.

using a get row activity to assign “age” to a int32, and “name” to a string would cause an exception in this case.

Is it possible to tell ui path to not include peters row in the output variable, and also report peter to another variable to be sent via email etc?


#2

Surround the get row item in a try catch, and have the catch test to see if the value is a string instead of a integer. If it is, skip to the next one and report somewhere that it was skipped - it depends on how you’re logging, if you’re adding another column to the spreadsheet or sending an email per exception.

Alternatively, you could get all the values as “objects” and then when processing each transaction build in a check to see if the value is a string or just numbers. It depends if your process is transactional or not :slight_smile:


#3

Thank KEntwistle! I’ll try messing about with the catch activity a bit more :slight_smile:

Not sure if objects would work as im working on a for each chain that works on %'s and it only seems to like int’s


#4

Are you using a queue?


#5

no, my current workflow is basically

get excel sheet -> take required columns from excel sheet and convert to a Datatable variable -> using get row activities assign columns to separate variables-> filter through variables using “if” activities -> send emails based on if activities.

to add context, I have a report that shows clients usage / % through contract and I’m working on using uipath to generate emails "client A is 5% through their contract but has already used “90% of their allowance”

which ive got working perfectly ( after pulling a lot of my hair out in the process :stuck_out_tongue: )

but if there is an issue with excel sheet which is user populated, the entire bot stops due to an exception.

What im trying to do is ideally send me an email if an except is found, and then continue ignoring that row.

So if its looking for a “#%” and someones entered a name into the wrong field, it doesnt stop the entire bot.

If none of that makes sense, I can quickly make a faux report & upload my bot


#6

Makes perfect sense, sounds like a try catch is your solution then :slight_smile:
Good luck!