How to set Files property of Enumeration Configruation in Foreach Loop Editor

  • |Hi there

    I have a For Loop container which is processing a set of files.

    Now there are a certain number of files which will be processed with a

    certain file path as follows:

    SVPP_ROYA_00001_00021_20200225_01.csv

    SVPP_ROYA_00001_00021_20200225_02.csv

    SVPP_ROYA_00001_00021_20200225_03.csv

    I want to set the property in The Editor for Enumerator Configuration (Files),

    so it would be as follows:

    SVPP_ROYA_00001_00021_20200225_**.csv

    I have a SSIS Variable referred to the above as  Dts.Variables["User::FileFullPath"]

    How can i set the Files path of the For Loop Enumerator to use my variable [User::FileFullPath]?

    Can this be done in Code in a scropt task?

    For example

    \Package\Foreach Loop Container.Properties[ForEachEnumerator].Files = Dts.Variables["User::FileFullPath"]

  • You can use an expression to set this property. As shown below, you can use a hard-coded expression to define this. If you already have a variable with this file pattern, you'd substitute that variable instead of the hard-coded expression.

    foreach

  • If you're setting the value of the Folder, then define the Expressions options to set the value of the Directory. If you want to set the value of Files, then set use the Expressions to set the value of FileSpec.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Hi Tim

    Thanks for you reply

    Ok so I can set the property for FileSpec to  @[User::FileImportMask] ie SVPP_ROYA_00001_00021_20200225_**.csv

    Now I can I loop through and capture each of my file names ] which match the file spec?

    SVPP_ROYA_00001_00021_20200225_01.csv

    SVPP_ROYA_00001_00021_20200225_02.csv

    SVPP_ROYA_00001_00021_20200225_03.csv

    What I want to do is to load them into an audit table

     

     

     

     

  • That's correct, except that you don't need two asterisks the file spec. A single asterisk will match multiple characters, so you could simply use SVPP_ROYA_00001_00021_20200225_*.csv.

  • If you want to match a single character, so match the value SVPP_ROYA_00001_00021_20200225_03.csv but not SVPP_ROYA_00001_00021_20200225_9.csv or SVPP_ROYA_00001_00021_20200225_100.csv then use ? as the wildcard operator, which represents a single character, not many: SVPP_ROYA_00001_00021_20200225_??.csv

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • As you are loading multiple files, are you concerned about the order in which they are loaded?

    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

Viewing 7 posts - 1 through 6 (of 6 total)

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