Change flow to detect file exists/not exists

  • I have the following flow (see attached) which works fine, there are two import files named:

    Suppliers.xml

    Jobseekers.xls

    The problem comes if one of these files don't exist in the directory, it fails.

    I need the flow to be able to detect if only Suppliers.xml exists only run the Process Suppliers,

    and if Jobseekers.xls exists only run that, but if both exist run everything.

    Does anyone know how I could look at doing that?

  • It can be done by adding two separate workflows for each of the files. And also to check for existence of a file you need to use ActiveX Script Task.

    This is the rough flow for your package.

    Send Mail Task

    -----> Create Temp Tables

    -----> Process Temp Tables

    -----> Script Task for file Existence of Suppliers.xml

    ----------> Process Suppliers

    ----------> Set Based Update Suppliers

    -----> Script Task for file Existence of Jobseekers.xls

    ----------> Process Suppliers

    ----------> Set Based Update Jobseekers

    --Ramesh


  • I've never tried this, but maybe you could use two Foreach containers - one executes for all (0 or 1) occurrences of Suppliers.xml and one for all (0 or 1) occurrences of Jobseekers.xls - just link them together in your Control Flow and they should execute if the file, or files, is/are found.

    Phil

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Great solution Phil - worked a treat 🙂

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply