for each loop problem

  • files are processed by foreach loop control flow task contain data flow task and move to archive after success of data folw task.

    That means control flow task contain three components (for each loop , data flow and file system (move to arcive)task)

    In data flow task I want to check the first character is digit then only process the file and move to arcive folder if the first character in not a digit then I will (redirect or ignore ) the rows. Then the filenames starts with non zero are data folw task ignore or redirect the rows and files are moved to arcive folder.

    Only error (fault component ) the files are not moving to arciveand the package stops and not process other files in the source folder.

    How can I handel this if the files sratr with non digit should (redirect or ignore ) and would not move to arcive folder all other files which start with zero will process and send to archive folder.

    tahnks

    pha

  • Phani,

    Write Disable expression on DFT and Archival tasks to disable/enable tasks, so that DFT and Archival will not work when those are disabled, for next iteration, i guess its diffcult to enable disabled task

    or pls do below instead above...

    1 create a variable to hold valid file or not, name it gblnvalidfile

    2. in for each, add new scrit task, check the file names is valid or not and set above vairable with some value like gblnvalidfile = true / false for that file

    3. Edit on the Success connector between script task and DFT, you will see Precedence constraint Editor dialog and change below

    Evaluation operation : Constraing and exression

    Exression = @gblnvalidfile = True

    and thats it, if valid file then it will execute your dft and archival, otherwise , it will fetch new file,

    Please let me know if you have any qtns, i have worked examle for this,

    regards

    RB

  • Thank you very much RB,

    I am new to SSIS so i am unable to get it working.

    I am geting error "The collection of variables locked for read and write access is not available outside of PostExecute."

    can you please give a woking example for me .

    thanks in advance,

    pha

  • Phani,

    Please find the attachment, to run this, create some valid/invalid files and point to that folder before running.

    Note, i have used activeX scrit task ( I have VSTA issue in my lappy), however when you use script task , declare read/write variables in Script tab --> right click on Script task ->edit, select Scrit tab.

    regards

    RB

  • Thank you very much . its works for me.

    God bless you,

    Its a great help to me.

    with regards

    pha

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

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