Hitachi Vantara Pentaho Community Wiki
Child pages
  • Set Session Variables
Skip to end of metadata
Go to start of metadata

Overview

This step helps users who want to use variables at the session level for transformations. For example, users can include this step with the Call Endpoint step in a transformation which allows them to hit their BA Server session when the transformation is run.

Description

The Set Session Variables step allows you to set the value of session variable.

Note: You must specify the complete variable specification in the format ${variable} or %%variable%% (as described in Variables). You can also enter complete strings in the variable column, not just a variable. For example, you can specify: ${java.io.tmpdir}/kettle/tempfile.txt and it will be expanded to /tmp/kettle/tempfile.txt on Unix-like systems.

See Also:

Call Endpoint

Get Session Variables

Options

Option

Description

Step Name

The name of the step as it appears in the transformation workspace. This name must be unique within a single transformation.

Apply formatting check box

Select this check box to convert your variable to string format. Variables can be of any data type, such as a date, integer, Boolean, or Array. Selecting this check box applies the string format to the variable so it can be used.

#

The order the fields will be passed.

Field name

Specify the name of the field which will provide the value to be stored in the session variable. If a value is not provided, the default value is used.

Variable name

Specify the name for the session variable which you want to create for this step. Specify the value using a complete string to return rows or add values to input rows. For example, you can specify: ${java.io.tmpdir}/kettle/tempfile.txt and it will be expanded to /tmp/kettle/tempfile.txt on Unix-like systems.

Default Value

Specify a default value to use for this variable.

Samples

Six example transformations are included in the attached archive.  

  • callEndpointExample.ktr -- This transformation executes three different endpoint calls where the module, service , and method are parameterized from the input fields.
  • setSessionVariable.ktr -- This transformation illustrates setting a session variable from an input stream. The Data Grid step is used to generate the field.
  • getSessionVariable.ktr -- This transformation retrieves the variable defined in the SetSessionVariable.ktr sample.
  • getRolesForUser.ktr -- This transformation fetches the roles for the 'Admin' and 'Suzy' personas by executing two calls to the /userrolelist/getRolesForUser endpoint.
  • listRepository.ktr -- This transformation executes two calls to the repository, fetching the folder structure from the repository from /Home. One call is executed with a depth of '1' and the other with a depth of '4'.
  • showPlatformVersion.ktr -- This transformation executes an endpoint call to retrieve the platform version.
  • No labels