You can create one or several contexts for a database analysis and select specific context values with which to execute the analysis. Defining context variables in analysis will enable you to run the analysis on different data using the same connection.
Prerequisite(s): You have already created a database analysis in the Profiling perspective of the studio.
Double-click the database analysis to open the analysis editor.
Select Window > Show View > Profiling > Contexts to open the context view in the Profiling perspective.
Click the [+] button at the top right corner.
The [Configure Contexts] dialog box opens and a context named Default is created by default.
Select the default context and click Edit to rename it, Prod in this example. Click OK.
In the open dialog box, click New... and enter Test in the [New Context] dialog box, click OK.
Select the check box preceding the context you want to set as the default context.
You can also set the default context by selecting the context name from the Default context environment list in the Contexts tab view.
If needed, move a context up or down by selecting it and clicking the Up or Down button.
In this example, set Test as the default context and move it up.
Click OK to validate your context definition and close the dialog box.
The newly created contexts are shown in the context variables table of the Contexts view.
Repeat the above steps to create as many new contexts as needed.
If you do not want to define the values of each new context from scratch, you can create the first context and define all its values as when you create a new one all the parameters of the context selected as default are copied to the new context. You can then modify the values of the new context as needed.
Click the [+] button at the bottom of the Contexts view to add lines in the table.
Suppose that you want to profile a postal_code column and you want to analyze the postal codes that start with 15 in the development environment and with 75 in the production environment. And that you want to allow different concurrent connections per analysis in the two environments.
Click in the Name field and enter the name of the variable you are creating.
Name the first variable where_clause for this example.
From the Type list, select the type of the variable.
If needed, click in the Comment field and enter a comment to describe the variable.
Click in the Value field and enter the variable value under each context.
For different variable types, the Value field appear slightly different when you click in it and functions differently:
String (default type)
Editable text field
Drop-down list box with two options: true and false
Character, Double, Integer, Long, Short, Object, BigDecimal
Editable text field
Editable text field, with a button to open the [Select Date & Time] dialog box.
Editable text field, with a button to open the [Open] dialog box for file selection.
Editable text field, with a button to open the [Browse for Folder] dialog box for folder selection.
List of Value
Editable text field, with a button to open the [Configure Values] dialog box for list creation and configuration.
Editable text field; text entered appears encrypted.
It is recommended that you enclose the values of string type variables between double quotation marks to avoid possible errors during Job execution.
If needed, select the check box next to the variable of interest and enter the prompt message in the corresponding Prompt field. This allows you to see a prompt for the variable value and to edit it at the execution time.
You can show/hide a Prompt column of the table by clicking the black right/left pointing triangle next to the relevant context name.
Repeat the above steps to define all the variables for the different contexts.
In this example, set the value of the where_clause variable in the Test context to
postal_code like '15%', and for the Prod context to
postal_code like '75%'. And set the value for the concurrent connections per analysis in the development and production environments to three and five respectively.
Click at the bottom of the view to import any of the contexts created and centralized in the studio repository and use it with the current analysis.