For Each file enumeration, check prefix of file name

  • Hi

     

    I'm importing a number of flat files into a DB table using a For Each loop container......

    I just want to import a file if the filename starts with a given character (for example "F"....could someone tell me with an example how to achieve this ?

    Thx

    Helmut

  • What "language" is the "For Each loop container" written in?  Seems like anything that can use wild cards should do...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • You can specify a wildcard for the for each loop. F*.* will work.

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

  • Hi and thanks for the answers...

    The FOr Each loop is the available "For each Loop" component available from the SISS toolbar........

    What about IF I want to have all files not starting with "F"....is it a good way of solving that as well, or how can I achieve that....??

     

    BR

    Helmut

  • Your best bet is then to use a *.* wild card.

    Inside your loop, drop a container control. This does nothing but lets you add a constraint between it and your next task.

    Double click the constraint and add and expression Substring([@user::MyFileNameVar], 1, 1) != "F"

     

    This will only go to the next step when the statement is true.

     

    HTH

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

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

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