Want to use Variables and Parameters as Expressions

  • Hi All

    I want to use Variables and Parameters as Expressions in my package but I'm facing some problems and your help will be highly appreciated.

    I did the following steps.

    Step 1

    Created the following variables:

    --1) Name = BankFileDestinationFile ,Scope=package1,DataType=String,

    Value=C:\test\archieve\20140318001621.txt,

    Expression=@[User::BankFileDestinationFolder] + "\\" + (DT_WSTR,4) YEAR (GetDate())

    + RIGHT("0" + (DT_WSTR,2) MONTH (GETDATE()),2)

    + RIGHT("0" + (DT_WSTR,2) DAY(GETDATE()),2)

    + RIGHT("0" + (DT_WSTR,2) datepart("hh",GETDATE()),2)

    + RIGHT("0" + (DT_WSTR,2) datepart("mi",GETDATE()),2)

    + RIGHT("0" + (DT_WSTR,2) datepart("ss",GETDATE()),2)

    + @[User::BankFileExtension]

    --2) Name = BankFileDestinationFolder,Scope=package1,DataType=String,

    Value=C:\test\archieve,

    Expression=@[$Package::BankFileSourcePath] + "\\archieve"

    --3) Name = BankFileExtension,Scope=package1,DataType=String,

    Value=.txt

    --4) Name = BankFileName=package1,DataType=String,

    Step 2

    1- Drag Foreach Loop Container in Control Flow

    2- In Collection, under Expression, I configure things like below:

    --Directory=@[$Package::BankFileSourcePath]

    --FileSpec = "*" + @[User::BankFileExtension]

    In Variable Mappings,under Variable =User::BankFileName

    Index =0

    Step 3

    Now I want to copy all source files into destination by using File System Task so I configure it like below :

    Destination Connection

    IsDestinationPathVariable = True

    DestinationVariable =User::BankFileDestinationFile

    Operation

    Operation=Copy File

    Source Connection

    IsSourcePathVariable = True

    SourceVariable =User::BankFileName

    But the problem is that I'm getting cross red sign on File System Task and it shows the following message .

    Put File System Task under Foreach Loop Container and configure like below:

    But the problem is that I'm getting cross red sign on File System Task and it shows the following message .

    "Variable BankFileName is used as source or destination is empty...

    Your help in this regard will be highly appreciated. Thanks

    Regards

    Muz

Viewing 0 posts

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