locked
How to identified the based the current month and dynamic attachment .txt file RRS feed

  • Question

  • Hi All,

         I have one folder  path E:\work\NZ\ious\Sep2012\ious.txt.

    Now my requirement in this path every month change like oct2012,Nov2012 and Txt file also change.That .txt file iam load into DB2 database. i have used flot file connection for loading the table .my problem is how to identified the flotfile connection current month folder and under .txt file.


    vasu

    Friday, September 28, 2012 5:18 AM

Answers

  • "E:\\work\\NZ\\ious\\"+(MONTH(getdate()) == 1 ? "Jan" :
    MONTH(getdate()) == 2 ? "Feb" :
    MONTH(getdate()) == 3 ? "Mar" :
    MONTH(getdate()) == 4 ? "Apr" :
    MONTH(getdate()) == 5 ? "May" :
    MONTH(getdate()) == 6 ? "Jun" :
    MONTH(getdate()) == 7 ? "Jul" :
    MONTH(getdate()) == 8 ? "Aug" :
    MONTH(getdate()) == 9 ? "Sep" :
    MONTH(getdate()) == 10 ? "Oct" :
    MONTH(getdate()) == 11 ? "Nov" :
    MONTH(getdate()) == 12? "Dec":"")

    + (DT_WSTR, 4) YEAR( getdate() ) +"\\ious.txt"


    If a post answers your question, please click "Mark As Answer" on that post or "Vote as Helpful".
    http://dwhanalytics.wordpress.com/

    Friday, September 28, 2012 7:05 AM
  • Hi

    Now achive month ( 09)   but i want full month name (september) like that

    Vasu


    vasu

    • Marked as answer by Vasu2049 Friday, September 28, 2012 7:24 AM
    Friday, September 28, 2012 7:11 AM

All replies

  • Hi, 

        i have identified some thing .In this flot file connection manger we are call the variable upto(E:\work\NZ\ious)

    after how to indentified the Sep2012/ious.txt.

    through varible (E:work\NZ\ious) calling this path after that i have required Currentmonth and year (sep2012) and oius.txt file is required

    How to achive this through expression builder.

    Regards

    VAsu


    vasu

    Friday, September 28, 2012 6:19 AM
  • Try whth the below expression

    • Go to file connection manager properties
    • In expressions select 'connection string' and use the the below expression.

    "E:\\work\\NZ\\ious\\"+((DT_WSTR, 2) MONTH( GETDATE() ) =="1" ? "JAN" : ((DT_WSTR, 2) MONTH( GETDATE() ) =="2" ? "FEB" : ((DT_WSTR, 2) MONTH( GETDATE() ) =="3" ? "MAR" : ((DT_WSTR, 2) MONTH( GETDATE() ) =="4" ? "APR" : ((DT_WSTR, 2) MONTH( GETDATE() ) =="5" ? "MAY" : ((DT_WSTR, 2) MONTH( GETDATE() ) =="6" ? "JUN" : ((DT_WSTR, 2) MONTH( GETDATE() ) =="7" ? "JUL" : (DT_WSTR, 2) MONTH( GETDATE() ) =="8" ? "AUG" : (DT_WSTR, 2) MONTH( GETDATE() ) =="9" ? "SEP" : (DT_WSTR, 2) MONTH( GETDATE() ) =="10" ? "OCT" : ((DT_WSTR, 2) MONTH( GETDATE() ) =="11" ? "NOV" :"DEC" )))) ) )))+ (DT_WSTR, 4)YEAR( GETDATE() )+"\\ious.txt"

    Friday, September 28, 2012 7:04 AM
  • "E:\\work\\NZ\\ious\\"+(MONTH(getdate()) == 1 ? "Jan" :
    MONTH(getdate()) == 2 ? "Feb" :
    MONTH(getdate()) == 3 ? "Mar" :
    MONTH(getdate()) == 4 ? "Apr" :
    MONTH(getdate()) == 5 ? "May" :
    MONTH(getdate()) == 6 ? "Jun" :
    MONTH(getdate()) == 7 ? "Jul" :
    MONTH(getdate()) == 8 ? "Aug" :
    MONTH(getdate()) == 9 ? "Sep" :
    MONTH(getdate()) == 10 ? "Oct" :
    MONTH(getdate()) == 11 ? "Nov" :
    MONTH(getdate()) == 12? "Dec":"")

    + (DT_WSTR, 4) YEAR( getdate() ) +"\\ious.txt"


    If a post answers your question, please click "Mark As Answer" on that post or "Vote as Helpful".
    http://dwhanalytics.wordpress.com/

    Friday, September 28, 2012 7:05 AM
  • Hi

    Now achive month ( 09)   but i want full month name (september) like that

    Vasu


    vasu

    • Marked as answer by Vasu2049 Friday, September 28, 2012 7:24 AM
    Friday, September 28, 2012 7:11 AM
  • Hi ,

      Its working fine.Thnks

    Vasu


    vasu

    Friday, September 28, 2012 7:23 AM
  • Hi

    Now achive month ( 09)   but i want full month name (september) like that

    Vasu


    vasu

    vasu,

    do you think that your post is the answer to your question ? You should always mark the post(s) as answer(s) which had answered your question. Also if you think a post had been helpful please vote for it also.

    Regards


    Hannes

    If you have got questions about this, just ask.

    In a perfect world,
    users would never enter data in the wrong form,
    files they choose to open would always exist
    and code would never have bugs.

    C# to VB.NET: http://www.developerfusion.com/tools/convert/csharp-to-vb/

    Wednesday, October 10, 2012 5:51 AM
  • Hi ,

         Iam new to forum anything is missing let me know. Iam useing this thing after that i got september month name

        

    "E:\\work\\NZ\\ious\\"+(MONTH(getdate()) == 1 ? "Jan" :
    MONTH(getdate()) == 2 ? "Feb" :
    MONTH(getdate()) == 3 ? "Mar" :
    MONTH(getdate()) == 4 ? "Apr" :
    MONTH(getdate()) == 5 ? "May" :
    MONTH(getdate()) == 6 ? "Jun" :
    MONTH(getdate()) == 7 ? "Jul" :
    MONTH(getdate()) == 8 ? "Aug" :
    MONTH(getdate()) == 9 ? "Sep" :
    MONTH(getdate()) == 10 ? "Oct" :
    MONTH(getdate()) == 11 ? "Nov" :
    MONTH(getdate()) == 12? "Dec":"")

    + (DT_WSTR, 4) YEAR( getdate() ) +"\\ious.txt"


    If a post answers your question, please click "Mark As Answer" on that post or "Vote as Helpful".
    http://dwhanalytics.wordpress.com/


    vasu

    Wednesday, October 10, 2012 9:30 AM
  • vasu,

    so it would be best to mark the post from _AKS as the answer and unmarking yours.


    Hannes

    If you have got questions about this, just ask.

    In a perfect world,
    users would never enter data in the wrong form,
    files they choose to open would always exist
    and code would never have bugs.

    C# to VB.NET: http://www.developerfusion.com/tools/convert/csharp-to-vb/

    Wednesday, October 10, 2012 9:48 AM