Reputation: 91
Can anyone please advice how to access/read system variables in Script Component (e.g I want to package name from this variable System::PackageName in Script Component)
Upvotes: 3
Views: 14718
Reputation: 1608
In the Script Task Editor, provide the variable names you want to access (for example System::PackageName) in the ReadOnlyVariables field.
From the script, in the C# example, use this:
public void Main()
{
bool fireAgain = true;
// Read the variable
String PackageName = (String)Dts.Variables["System::PackageName"].Value;
// Post the value to progress results
Dts.Events.FireInformation(3, "Package name:", PackageName, "", 0, ref fireAgain);
Dts.TaskResult = (int)ScriptResults.Success;
}
The results:
Upvotes: 11