Variable file name
I want to get a file from a UNIX box, appended to data in a flat file that I have extracted from our SQL server. However, the file on the UNIX box has a variable file name, in that it has the date appented to its name e.g. OPAPPT.FGO20080614 I already have the rest of the package running on a schedule, hence can anyone help with the FTP Task so I can fully automate?
June 16th, 2008 5:00pm

Use a property expression, such as - "OPAPPT.FGO" + (DT_WSTR,8)((YEAR(@[User:ateTimeVar]) * 10000) +(MONTH(@[User:ateTimeVar]) * 100) + DAY(@[User:ateTimeVar])) Some sample expressions - http://wiki.sqlis.com/default.aspx/SQLISWiki/ExpressionDateFunctions.html Property expressions are the way to do dynamic stuff like this in SSIS. How to: Create a Property Expression
Free Windows Admin Tool Kit Click here and download it now
June 16th, 2008 6:45pm

I know it is some time now, but this project was droped and is now back in a different formate. I have and expression, and when I evaluate the expression, it calculates correctly. Expression = "E:\\Greenpark_Flat\\Weekly-OP\\Archive\\OPPROC.PAS" + (DT_WSTR, 8)((Year(@[User::Variable]) * 10000) + (Month(@[User::Variable]) * 100) + DAY(@[User::Variable])) Evaluation = E:\Greenpark_Flat\Weekly-OP\Archive\OPPROC.PAS20080708 Which is putting todays date on the file. I am using the "file system task editor" to move the file to archive after use, however I keep getting a "file not found" error But of course the file doesn't exist as I want to create it (move it to that location) it is after all a destination file. directory path is correct, and read/write permissions is available for all local users. the Destination value in the task editor = E:\Greenpark_Flat\Weekly-OP\Archive\OPPROC.PAS20080708 TITLE: Microsoft Visual Studio ------------------------------ Nonfatal errors occurred while saving the package: Error at OP_Weekly_To_Flat: The connection "E:\Greenpark_Flat\Weekly-OP\Archive\OPPROC_PAS\OPPROC.PAS20080708" is not found. This error is thrown by Connections collection when the specific connection element is not found. Error at OP_Weekly_To_Flat: The connection "E:\Greenpark_Flat\Weekly-OP\Archive\OPPROC_PAS\OPPROC.PAS20080708" is not found. This error is thrown by Connections collection when the specific connection element is not found.
July 8th, 2008 12:21pm

You need to delay the validation of the dependent tasks, for which there is a property on all containers/tasks. A more detailed explanation - http://wiki.sqlis.com/default.aspx/SQLISWiki/DelayValidation.html
Free Windows Admin Tool Kit Click here and download it now
July 8th, 2008 1:29pm

Thanks for the quick reply. "Delay validation" does allow this part of the package to execute, but it still returns the error that it cann't find the file, which is correct as I want to create the file (Move and rename - mark with time stamp) Error: Failed to lock variable "E:\Greenpark_Flat\Weekly-OP\Archive\OPPROC_PAS\OPPROC.PAS20080708" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.". Can I add In the expression "Property Type" I have set to "Destination" . Has this anything to do with the problem, or what should it be.
July 8th, 2008 1:59pm

I have got it sorted. The answer is not to build your expression in the "File System Task editor" but in your variables. I created three variables Variable = E:\Greenpark_Flat\Weekly-OP\Archive\OPPROC_PAS\OPPROC.PAS of type string variable1 = 08/07/2008 of type date ----- (todays date will be created by the system) variable2 = of type string, in the properties set EvaluateAsExpression = True, and in the expression enter @[User::Variable] + (DT_WSTR, 8)((Year(@[User::Variable1]) * 10000) + (Month(@[User::Variable1]) * 100) + DAY(@[User::Variable1])) In the "File System Task editor" select User::Variable2 for DestinationVariable This seems to be doing in three steps what I had originally tried to do in one. Goes to show that the long way round is sometime better.
Free Windows Admin Tool Kit Click here and download it now
July 8th, 2008 3:08pm

Hi Joe, It's been a while so don't know if you'll get this. Anyway, I having a similar problem and don't understand why/how your answer fixed your problem. I have a rename filesystask that moves a file to a directory which doesnt exist at the time of validation. So I get the 'not found' error from connections collection at validation. The thing is, my fsys task is already using a variable for destination rather than expression. Would it be the fact that you set your variable EvalutateAsExpression to true thqat prevents the validation error? I haven't do so because my variable is not from an expression so it's not neccessary, but I'm wondering if this is how you got the validation error to go away? TIA, Josh
December 17th, 2010 9:40am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics