Import File that doesn't already exist in the database table

I need to know how to Import Excel files that don’t already exist in the database table.
We have several excel files from different vendors, so I have created a column on the import excel file that has the Vendor Name and Month/Year as FileName.
I created a table in EasyMorph that contains distinct FileNames that are already in the database using a database command (FilesAlreadyImported) table.
I want to somehow let the user know when they select a file to import, it checks to see if the file exist in (FilesAlreadyImported) table, and if it exist send a error message or some way display that the file has already been imported into the database and halt the project.

@Lea, here is an example project: Example.zip (22.6 KB)

Name of an Excel file, which should be imported, has to be set to {FileToImport} parameter.

“Create list” action is used to create that table in the example, but you can use any other data source, supported by EasyMorph.

{FileToImport} parameter is matched against FilesAlreadyImported table by “Halt on condition” action.

In case parameter value is found in the FilesAlreadyImported table, an error is issued and project execution stops.

In case it isn’t found - project execution continues and specified file is imported as usual.

You can test both of these cases with XLSX files, packaged with the example project.

Wow Andrew you are on a role, thanks again. I never would have figured this one out… Can I ask you one more question. Can I use this with my iterate projects and have it skip this file, so the other files get loaded using the scheduler

Sure. But it’s better to filter out files which were imported in the main project and then only iterate over files which were not imported.

Also if your Excel files don’t have to be processed one-by-one, you don’t have to use iterations. You can just create a column with a list of files which should be imported and use “Load list of files” mode of “Import Excel spreadsheet” action:

image

Thank you again andrew