Custom global function - accessible to all DTS packages?

  • Hi

    I use an ActiveX script to check the validity of source files before dumping the contents of the source file into the database.

    Currently, each DTS package has the same ActiveX script pasted in, with a slight change to the source file name so it is relevant to the current DTS package.  This is fine and works a treat, except if I need to change the validity checking code, and then every DTS package has to have the ActiveX script updated.

    Is there a way of making my validity checking code global so that every DTS package can reference it?  Or is there another way other than using an ActiveX script that people would recommend?

    Ideally, I don't want to have to create a COM component (or similar), but all options will be considered.

    Thanks

    Michael

  • If the only thing that is changing is the filename why not create a single DTS package that is called from all the others that does the checking?  This way you can manage the code in one place and it should be easy to incorporate.  Another way is to build a VB application that is called by all the different DTS packages that would do the same thing....

     



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • Ooo, yes that's a good idea!  Despite using DTS packages within DTS packages elsewhere, I had never considered it for this problem.  I'm off to give it a go...

    Thanks 🙂

  • You could also consider using an .ini file to hold the variable which would then be referenced by each package.  Somewhere on this fine website is an article to the effect of "Using ini files with Global Variables" to help you through this.

  • The use of an 'execute package task' is working well.  However, if I change the package that does the validation a new version is created.  This means that my parent packages will point to an old version of the validity checking package unless I change the reference.

    What is the best way of ensuring that the parent packages always reference the latest version of the validity checking package?  Is it best to do it programmatically using ActiveX?

    I have tried searching the site for similar information, so apologies if it has been covered elsewhere.

    Thanks for the ini file tip.  I will look into that approach too.

  • Select only the package name, not a version, when you define your Execute Package task.  If you specify only the name, DTS will always use the latest version.

    Greg

    Greg

  • another way of ensuring that only the latest version is ever used is to save as a Structure File on the hard drive and when you update the package save with a different name rename the old to .old.date or whatever versioning you want and then rename the newest package to the name you want



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • Thanks for all the information 🙂

     

  • Seems when I select a Package Name, the PackageID is auto selected.

    Don't remember where I found this but it works ok.

    Create a global variable of type string. Click Value and backspace until it is empty (supposedly results in NULL value).

    In a Dynamic Task at the beginning of the parent package, set the PackageID of the package being executed to this global.

    One caveat, when the parent package is opened, modified, and saved the global will be set to <not displayable>.  Make sure it is cleared before the save or your process will fail with an invalid version reference. This doesn't seem to happen all of the time, but make it a habit to check if you used this method.

     

     

     

     

Viewing 9 posts - 1 through 8 (of 8 total)

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