Best practice for variable manipulation?

  • I was wondering what the pros and cons to alter the variables in a script task or expression editor are. I have been changing values in the Script task since I could walk through the script and see the values in the debugger. I also think C# along with its intellisense is much easier than the expression language to use.

    For example in all my packages I use two package parameters, prmDirectoryRoot and prmEnvironment. Then I build my variables, varDirectoryStaging, varDirectoryOutbound and varDirectoryArchive in my script. My code looks sort of like below. I left out the detailed syntax.

    --Build the variables

    varDirectoryStaging = prmDirectoryRoot + "\\" + prmEnvironment + "\\" STAGING

    --Create the directories if they exist..

    File.IO.CreateDirectory(varDirectoryStaging)

    Thoughts?

  • Phillip.Putzback (6/9/2015)


    I was wondering what the pros and cons to alter the variables in a script task or expression editor are. I have been changing values in the Script task since I could walk through the script and see the values in the debugger. I also think C# along with its intellisense is much easier than the expression language to use.

    For example in all my packages I use two package parameters, prmDirectoryRoot and prmEnvironment. Then I build my variables, varDirectoryStaging, varDirectoryOutbound and varDirectoryArchive in my script. My code looks sort of like below. I left out the detailed syntax.

    --Build the variables

    varDirectoryStaging = prmDirectoryRoot + "\\" + prmEnvironment + "\\" STAGING

    --Create the directories if they exist..

    File.IO.CreateDirectory(varDirectoryStaging)

    Thoughts?

    I do this stuff with variable expressions. No reason to waste a script task on that, IMO. And you can see the results of your expressions by hitting the evaluate button.

    Here's an example of one I am working on now (to set a full file path, with static folders but variable file name):

    @[$Project::WorkingFolder]+ @[$Package::Subfolder]+ @[$Package::SendFolder]+ @[User::ExtractFilename]+".xlsx"

    More complex than yours, I'll agree. But not much. (I put trailing slashes on my folder parameters, by the way.)

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

Viewing 2 posts - 1 through 1 (of 1 total)

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