Flat File connection Manager - File Name, The Folder in File Name changes every time the package is reopoened and needs resetting

  • 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

  • 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.

  • 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. :crazy:

  • 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.

  • 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?

  • :doze: 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

  • 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.

  • Debbie Edwards (2/21/2013)


    :doze: 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.

  • 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

  • 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.

  • kl25 (2/21/2013)


    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.

    Ah ha!!!

    Ive added the file path in with the file name that is only used to create the CSV files and it seems to have dont the trick. It means that if I change the folder I have to go into the SQL View I have created to alter it but at least it is working.

    Yeeeeeeeeey

    Thank you, that list was really helpful.:-)

  • You're welcome. Glad you got the issue worked out. 🙂

  • kl25 (2/21/2013)


    You're welcome. Glad you got the issue worked out. 🙂

    Your Full File Name made me realise where I was going wrong. Thank you again. What a day

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

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