Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Flat File connection Manager - File Name, The Folder in File Name changes every time the package is reopoened and needs resetting Expand / Collapse
Author
Message
Posted Thursday, February 21, 2013 5:53 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, August 15, 2013 7:58 AM
Points: 423, Visits: 635
Very strange issue.

I have SQL Tables and Im using a For Loop to split the table up via a variable and sent data to different CSV Files.

In the connection Manager its self I have juse added an example folder and file name

The data is split via a variable, and another variable creates the CSV Name in the Flat File connection Managers properties - Expressions - Connection String.

However when I save and close and then I go back in, within File Name, the folder has changed (Not the example file name given) just the folder. This means every time I open it up I have to go back in and reset the folder.

Its never the same folder either. If I run without doing this I cant figure out where the files are being sent too.

Has any one got any clues as to what I can do to sort this out.... or test?

Debbie
Post #1422516
Posted Thursday, February 21, 2013 8:06 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 12:18 PM
Points: 2,818, Visits: 2,561
Can you give a few examples of the folder names being generated? Also double check your file name expressions, maybe you have a missing \ or something. Is the folder supposed to be a fixed name? If it is driven from a variable with an expression that might be the issue.
Post #1422612
Posted Thursday, February 21, 2013 8:27 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, August 15, 2013 7:58 AM
Points: 423, Visits: 635
Its very strange. Its gone to about 3 different places. Almost like the last folder I was looking at when I was working on a different project.

I realised I needed to go to the flat file connection properties and expressions. For the connection String property it was set to just @[User::DFES_NAME_DATE_File_Name]+".csv"

So basically the file name with no folder attached.

I tried to change this to

"\\D-fs11\\spar-it\PROJECTS\\1 Active Projects\\DATA WAREHOUSING PROJECT\\Development\Extract_To_CSV\\"+@[User::DFES_NAME_DATE_File_Name]+".csv"

And was told that the token [Square bracket symbol] was not recognised. So I took that to mean the spaces in the folder names. I tried replacing them but nothing helped.

I then tried using another variable as the folder name so used the variable @Folder_Name which was already set with the actual folder name. This seemed to be good but when I ran it, the file names were created with [User::DFES_NAME_DATE_File_Name] twice but the first one was the same one every time and the second one was looped so this completely lost me.

So as yet I havent sorted it and worse Ive spent nearly all day trying to figure it out which is a massive waste of time on such a small thing.
Post #1422625
Posted Thursday, February 21, 2013 8:43 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, August 25, 2014 11:36 AM
Points: 493, Visits: 1,867
These are tough problems to troubleshoot. For me, they've always been some small part of a variable or an expression. You've probably looked at the following but just in case...

I tried to change this to

"\\D-fs11\\spar-it\PROJECTS\\1 Active Projects\\DATA WAREHOUSING PROJECT\\Development\Extract_To_CSV\\"+@[User::DFES_NAME_DATE_File_Name]+".csv"



Notice the single backslash. That would probably lead to the token not recognized message. [Edit note:] My attempts to highlight the backslash aren't working very well. It's between 'Development' and 'Extract_To_CSV'.



I then tried using another variable as the folder name so used the variable @Folder_Name which was already set with the actual folder name. This seemed to be good but when I ran it, the file names were created with [User::DFES_NAME_DATE_File_Name] twice but the first one was the same one every time and the second one was looped so this completely lost me.


I fought through a loop naming problem like this just recently. It turned out that I had added part of the expression for the name in two separate places, once in the variable expression for the file name and once in the actual final file name (including folder path) . So at each loop, each place was adding to the final name. Don't know if that's what happened here but it sounds similar.
Post #1422639
Posted Thursday, February 21, 2013 8:43 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, August 15, 2013 7:58 AM
Points: 423, Visits: 635
Heres a thought.....

In the Flat file connection managers properties I have

ConnectionString set to \\D-fs07\spar-it\PROJECTS\1 Active Projects\DATA WAREHOUSING PROJECT\Development\Extract_To_CSV\Test.csv

And Expressions Connection String set to @[Extract_To_CSV_Folder]+@[User::DFES_NAME_DATE_File_Name]+".csv"

The fact there are 2 connection strings is very confusing. Could this be why its going wrong?
Post #1422640
Posted Thursday, February 21, 2013 8:45 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, August 15, 2013 7:58 AM
Points: 423, Visits: 635
your right! I think Im going to have to reask for a bigger screen, I dont think my eye sight is doing me any favours. Ill have another go at that one
Post #1422645
Posted Thursday, February 21, 2013 8:48 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, August 25, 2014 11:36 AM
Points: 493, Visits: 1,867
Debbie Edwards (2/21/2013)
Heres a thought.....

In the Flat file connection managers properties I have

ConnectionString set to \\D-fs07\spar-it\PROJECTS\1 Active Projects\DATA WAREHOUSING PROJECT\Development\Extract_To_CSV\Test.csv

And Expressions Connection String set to @[Extract_To_CSV_Folder]+@[User::DFES_NAME_DATE_File_Name]+".csv"

The fact there are 2 connection strings is very confusing. Could this be why its going wrong?


Probably not the issue here. The expression would replace the hard coded connection manager when the process runs.
Post #1422647
Posted Thursday, February 21, 2013 8:49 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, August 15, 2013 7:58 AM
Points: 423, Visits: 635
Debbie Edwards (2/21/2013)
your right! I think Im going to have to reask for a bigger screen, I dont think my eye sight is doing me any favours. Ill have another go at that one


Nope Id already sorted that one out the last time I had ago and Im still getting the same error about the [Square symbol] not being recognised.

And adding the folder as a variable is doing even crazier things.

And I dont understand Why I have in properties ConnectionString and Expressions - ConnectionString.
Post #1422648
Posted Thursday, February 21, 2013 8:52 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, August 15, 2013 7:58 AM
Points: 423, Visits: 635
kl25 (2/21/2013)
Debbie Edwards (2/21/2013)
Heres a thought.....

In the Flat file connection managers properties I have

ConnectionString set to \\D-fs07\spar-it\PROJECTS\1 Active Projects\DATA WAREHOUSING PROJECT\Development\Extract_To_CSV\Test.csv

And Expressions Connection String set to @[Extract_To_CSV_Folder]+@[User::DFES_NAME_DATE_File_Name]+".csv"

The fact there are 2 connection strings is very confusing. Could this be why its going wrong?


Probably not the issue here. The expression would replace the hard coded connection manager when the process runs.


Ah, so its definitely using the ConnectionString one. Im totally lost now as to how Im going to get the folder name in there, Unless I change all my folders to be in the C drive, without spaces in the Names, but I feel like that would be the wrong way to go, you should be able to have your folders any where, not just the C Drive
Post #1422650
Posted Thursday, February 21, 2013 9:00 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, August 25, 2014 11:36 AM
Points: 493, Visits: 1,867
Here's the general approach I use:

1. Set a variable for the path (folder). Learned early on to separate the path because paths that I thought would NEVER change did.
2. Set a variable for the file name. This is often an expression to allow including the run date or other important but changing aspects of the file name.
3. Set a variable for the full file name. This is always an expression of @Path + @FileName.
4. Set the expression for the connection string to @FileNameFull for the flat file connection manager via the properties window, expressions section.

I think that's what you're doing but I'm not positive.
Post #1422653
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse