Skip to main content
Nintex Community Menu Bar

I am looking for a workaround/steps that can resolve our issue of getting an Error when importing a database with no records in it. We have a scheduled botflow via RPA Central that pulls in an excel file but on a rare occasion, there are no records in the file. RPA stops and produces an error that it can't import data due to no records (attached). The 'Open Data' action doesn't have the normal settings to run an error task. Thanks for any wisdom that you can share!

Hi, Ray,

There is no way currently to run an error task when the Open Data doesn't contain any data. I'll discuss with the team for any workaround that we can think of.

Thanks,
Mike

Hi Ray,



 



  We have this similar issue to.  What we have done is to create actions to open Excel and look for data in cell A2 (assuming your data has headers).  Then use an If/Else action.  If it finds data close Excel and then runs the open data step. Else, close Excel and closes down the bot.  If you wanted an error task you can place it before the close bot steps.  You may need to do some minimize steps when you close Excel due to pop ups that ask if you want to save even though you didn't do anything.  We use this for about 20 bots so it has proven successful for us.


We use CSV input files and after the "wait for file action" is successful I use an embedded PowerShell script to look for the number of records.  If the number of records is zero I go to an error routine that sends an email and exits the botflow.



 



You have to have a variable in your botflow because the last line is where the bot reads the value when PowerShell exits.  In this case I used FileRecords to return the record count.  A similar approach could be used with Excel using ComObject.



 



$inPath = "C:RPA Input"



$fileList = Get-Childitem -Path $inPath | Where { $_.extension -eq ".csv"}



$records = (Import-CSV $fileList.FullName | Measure-Object).count




RPAEngine.SetVar -Variable "FileRecords" -Value $records


Reply