Naphstor
Naphstor

Reputation: 2496

Using variables in SSIS Data flow task and Execute process task

I created a package and added a data flow task that reads the data from database and creates a flat out xml file. It then stores the file in the path I have given and the execute process task uploads it to a remote server. Below is how the structure looks like:

enter image description here

The data flow task is something like this:

enter image description here

The execute process task is like below:

enter image description here

So they all work fine right now as I have absolute directory paths for data flow flat out file process and in the Execute process task.

But what I am trying to do is to remove the absolute path and use relative path to the root folder of my package.dtsx file instead for all the executable, storing the flat out xml file etc.

So after researching online these two links here and here proved very helpful. I created a variable and the script task as shown in the first screenshot above. The details of the script task are:

enter image description here

Below is the main function of script task:

enter image description here

After adding the variable I am able to see in the package properties that the variable PackagePath is assigned some value like this \Package\task-name:

enter image description here

But I am not sure what path is that and how to get to the root directory or assign the root directory path to the variable.

I am new to SSIS so not sure if I am doing it wrong or missing something. Been struggling last couple days to figure it out. Any help is appreciated.

Upvotes: 2

Views: 2363

Answers (1)

Hadi
Hadi

Reputation: 37368

To use variables in Execute Process Task, you have to use expressions, open the Execute Process Task editor, Go To expressions Tab and write your expressions.

You can refer to this article for a detailed example:

Also you can read more about Execute Process Task and writing expressions at:


Note: Right click on your Execute Process Task and select Properties. In the properties window, you will have a DelayValidation option that is currently set to False Flip that to True.

Upvotes: 2

Related Questions