Global Variables for new INI Location

  • HI there:

    I have 50+ DTS jobs that currently use an INI Files. However, in my dev server all INI are located at C:\WINNT\File.ini and obviously my objects are pointing to that folder. Now, some smarty decided that all INI files in Prod Server will not be located at D:\APPS instead.

    Since I cannot use D: in my dev server (for it being the CD Drive), somebody suggested to me I could use global Variables. Ok-I can set the variables, but I don't know how to modify the DataSource property of those Connections from my Dynamic Porperties Task.

    The idea was: I create a variable with my prod location directory and modify the properties during runtime.

    Any idea?

    Tks,

    Rogerio

  • You could change the drive letter of the CD drive on the dev server. Then use subst to map D: to a directory.

    Hope this helps.



    Mark

  • Yeah...we thought about that, but we'd like o have a programmed solution...

    Anyways, I found a code were somebody did the same in VB and just had to figure out how to translate that to VBScript. So I did it...Now I have a Global Variable for each package pointing to the right location and I placed an ActiveX Script as the firts step of every jog I needed to change the INI and it would modify its property accordingly.

    So here is the script:

     

    '**********************************************************************

    ' Visual Basic ActiveX Script

    '************************************************************************

    ' This function is going to be used to set the location of the INI files among different servers.

    ' Since locally the INIs are located under C:\WINNT and on the server they must be located at D:\APPS

    ' we attach this routine that will read one Global Variable and replace the File property of the Dynamic Properties Task

    ' **** IMPORTANT ****

    ' Before promoting a DTS from DEV to any other environment you MUST modify the Package Global Variable to its

    ' correspondent directory

    Function Main()

    Main = DTSTaskExecResult_Success

    'declare variables

    set pkg = DTSGlobalVariables.parent

    dim custask

    dim assign

    dim assign1

    'Get reference to the task we want to modify

    set custask = pkg.Tasks("DTSTask_DTSDynamicPropertiesTask_1").Customtask

    ' get a reference to the collection of Dynamic properties assignments

    set assign = custask.Assignments

    'Read Global Variable with Path and Ini File Name wanted to be pointing to

    strIniFilePath = DTSGlobalVariables("gVarPath").VALUE

    ' loop through assignment

    for each assign1 in assign

    If assign1.SourceType = DTSDynamicPropertiesSourceType_IniFile Then

    assign1.SourceIniFileFileName = strIniFilePath

    End If

    next

    set assign = nothing

    set custask = nothing

    set pkg = nothing

    Main = DTSTaskExecResult_Success

    End Function

     

  • You still have a potential problem with the Global Variable setting - hence your instruction:

    ' **** IMPORTANT ****

    ' Before promoting a DTS from DEV to any other environment you MUST modify the Package Global Variable to its

    ' correspondent directory

    In my experience programmers & deployment people are inclined to overlook this sort of instruction.  You could overcome this by storing the ini directory name in a control table on your development & production machines.  You can then establish a connection to this table using the '(local)' database name & read the value into your global variable via a SQL query in another Dynamic Properties Task.  Alternatively you could possibly store all your ini values in a control table and replace your ini file with queries in each Dynamic properties task, but maybe that's too much work given multiple ini settings in 50+ packages.


    Cheers

    Filet

Viewing 4 posts - 1 through 3 (of 3 total)

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