simple ForEach loop to move files

  • I have a foreach (of type=file) loop , and I have the variable mapping set to return the 0 index to a variable called strfilename.

    I then have a filesystemtask inside of this.  For the type, I have Move file.  IsSourcePathVariable=true, SourceVariable=strfilename.

    This thing ought to run like a charm.  But it tells me "Error at File System Task [File System Task]: Variable "strfilename" is used as a source or destination and is empty.".  But why?  at run time, this variable should be being filled by the ForEach loop.  What am I doing wrong here?

     

  • Difficult to help without knowing more. Can you provide screenshots of the config of your Foreach container?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • attachment

    Attachments:
    You must be logged in to view attached files.
  • attachment 2

    Attachments:
    You must be logged in to view attached files.
  • attachment 3

    Attachments:
    You must be logged in to view attached files.
  • attachment 4

    Attachments:
    You must be logged in to view attached files.
  • attachment 5

    Attachments:
    You must be logged in to view attached files.
  • Looks OK to me!

    What is the scope of variable strfilename?

    You could try adding a pre-execute breakpoint to your FST (click once on it to select and then press F9). Then execute again and, when execution hits the breakpoint it will pause, allowing you to check the values of all of your local variables for possible clues.

    --Edit: I see that you've already answered the Scope question.

    • This reply was modified 4 years, 1 month ago by  Phil Parkin.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • For your future reference, note that you can also display images in-line, like so

    1

    Which helps reduce the amount of clicking for people viewing the post.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • oh ok, thanks.  I tried pasting a copied bitmap but didn't work so i assumed i couldn't.

    ok so i think i solved it ... your answer that it looked OK sparked my mind to the answer so I appreciate it! - all I did was put delayvalidation to True for the FST and now it works.  it was stuck trying to validate the source file.  interesting - there are other ssis functions that don't behave that way, i guess you never know.

  • Well done. My debugging idea would also have helped you get to this ... and in future, I suggest that you learn to watch out for validation errors vs runtime errors.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • good advice, thanks

Viewing 12 posts - 1 through 11 (of 11 total)

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