Hi all,
I'm trying to find some way to implement a move file task in my Data Flow. I parse through a flat file, retrieve a value, then I'm using a lookup table to check if that value exists in a table... if the value doesnt exist, I need to move this file to a new directory and insert the value into a different table. Does anyone have any ideas about how to move the file while using the Data Flow pane?
Or is there some way to pass information from the look up table to the Control flow pane and use the Move File Task there? I'm trying to stay away from a Script task or a Script component unless it's unavoidable. I appreciate any ideas!
Can you use a row count transform? Put it on the error output of the lookup. If the value doesn't exist, the variable you specify in the row count will be incremented by 1. Then you'd use that variable in an expression on a precedence constraint between the data flow and the File task.
Note - it sounds like you are processing a single value in the data flow. If you are trying to process multiple items, this may not work.
|||
You could also try the Import/Export Column transforms. I've never used them myself but I think they do what you're talking about.
-Jamie
|||
The import/export columns appends or creates the column information to a file. This isnt quite what I need. The existing file where I'm parsing the serial number using a Script Source component needs to be copied to a directory if that file is valid. There is one serial number per file (with other necessary information) if the serial is validated, then that particular file needs to be copied to a folder (like some Validated folder). In this way, files with invalid/valid serial numbers need to be sorted to a Invalidated/Validated folder(s) after they have been checked.
So far I have a data flow task within a Foreach Loop container and within the data flow task, the Script component grabs the serial, and next a Lookup component checks whether this serial is valid (normal output) or invalid (error output). Now from there, I'm not sure how to proceed because I want to use this information to move the file to its necessary folder (Validated/Invalidated). I hope this makes more sense! 
|||
See my post above. Add a row count transform to the error output. If the file has a valid serial number, the row count will be zero, if it is invalid, rowcount will be one. In the control flow, add two File System tasks - one that moves to the validated folder, the other that moves to the invalidated folder. Add a precedence constraint between the data flow and each file system task:
Code Snippet
DF
|
|-|
| |
FS FS
Set the validated precedence constraint to Evaluation Operation : "Expression and Constraint", Value: "Success", Expression: @.rowCountVariable==0
For the invalidated precedence constraint, set the Evaluation Operation : "Expression and Constraint", Value: "Success", Expression: @.rowCountVariable==1
|||
Thanks Mr. Welch! I missed the earlier post, sorry bout that! Worked perfectly... !