Using CodeSlice

Scripting is one of the most powerful extensibility features in SSIS. It gives developers the ability to extend the native functionality within SSIS to accommodate their specific needs. However, scripting can be difficult to use, and sharing useful scripts across packages and within development teams can be challenging. CodeSlice simplifies this process by providing a step-by-step interface for inserting scripts within packages.

Overview

Insert Code Slice Overview

CodeSlice gives users the ability to add Script components and tasks to their SSIS Packages directly from within their development environment.

CodeSlice can be launched by right-clicking anywhere within the design surface of the control or data flow and then selecting Insert Code Slice.

Once CodeSlice has loaded, there are a series of pages that help users configure the slice for their package. These pages change depending on the selected slice. For example, some slices may not require parameters or connection managers. In those cases, the Configure Parameters or Select Connections doesn't display.

PageDescription
Select Slice
Select the programming language and the slice to configure.
Enter Name
Provides the user with options for editing the name, description, and (if applicable) the ability to map an input for data flow transform and destination slices.
Configure Parameters
Configure parameters if the selected slice contains parameters.
Select Connections
Map existing packages or project connection managers found within the SSIS Package.
Configure Variables
Configure the variable(s) available to the code slice.

Note:  Navigate between the CodeSlice pages by selecting Previous or Next on the lower right of each page.

SentryOne Codeslice Page Navigation buttons

Select Slice

Select Slice

Select the programming language and the slice to configure on the Select Slice page.

SentryOne Codeslice Select slice page

Note:  Slices available on the Select Slice page are design surface dependent and vary based on the specified design surface.

OptionDescription
LanguageThe programming language used to generate the script component or task. The following languages are available:
  • C#
  • VB
SliceThe name of the slice that's used to generate the script component or task.
Description
A brief description of the selected slice.
Author
The original creator of the selected slice.
LicenseThe license agreement that the user agrees to when he or she generates a script using the selected slice.

Once a slice has been selected, select Next.

Enter Name

Enter Name

Configure the name and description of the Script component, or task, that's generated on the Enter Name page.

SentryOne Codeslice Enter name page

OptionDescription
Name
The name of the script component or task that's used once the script generates.
Description
A brief description of the selected slice. Changing the description updates the Script component or task's description property once the script generates.
Input Mapping
Input mappings are required for some slices. A list of all available data flow outputs is available within the Input Mapping drop-down window.
IconDescription

SentryOne Codeslice Valid Property Icon
Represents properties that are currently in a valid state.

SentryOne Codeslice Invalid Property icon
Represents properties that are currently invalid and prevent the user from proceeding further.

Note:  For some data flow slices, users can map a data flow output to the generated script's input.

Once all properties are in a valid state, select Next.

Configure Parameters

Configure Parameters

The Configure Parameters page provides a list of all the parameters for the currently selected slice. Type directly into the parameter window, or switch the parameter to be bound to a variable.

SentryOne Codeslice Configure parameters pageYou can configure the parameters using direct input or you can switch to having a parameter bound directly to a variable. You can bind either to an existing variable, or create a new variable by selecting New Variable.

Parameter IconDescription

SentryOne Codeslice Bind Variable icon
Binds the current parameter directly to a variable within the SSIS Package.

SentryOne Codeslice Unbind Variable Icon
Unbinds the current parameter from a variable, reverting the parameter to allow users the ability to directly input values within the generated script.

SentryOne Codeslice Vaild Parameter Icon
Represents parameters that are currently in a valid state.

SentryOne Codeslice Invalid Parameter Icon
Represents parameters that are currently invalid and prevent the user from proceeding further.

Important:  Only variables that match the data type for the parameter display within the list of available variables.

Select Connections

Select Connections

If the currently selected slice requires connection manager(s), the Select Connections page providers users the ability to map existing package or project connection managers found within the SSIS Package to the connection managers within the generated script.

SentryOne Codeslice Select conections pageOnce all connections have been configured, select Next.

Configure Variables

Configure Variables

The Configure Variables page provides allows the to configure the variable(s) available to the code slice. Variables that were bound to parameters on the Configure Parameters page automatically appear within the list of variables.

SentryOne Codeslice Configure variables page

Note:  Variables appear as Read-only or Read-write based on the parameters they are bound to.

Further customize the script after CodeSlice generates it with more variables. Move variables to the Read-only or Read-write lists by selecting the desired variable and then selecting the appropriate arrow to add or remove them.

Important:  Variables that are bound to parameters cannot be removed from the lists of Read-only or Read-write variables. To remove those variables, first remove them from their respective parameter binding.

Once you're satisfied with the variable configurations, you can select Finish.