Defining contexts and variables in a Job script - 6.5

Talend Job Script Reference Guide

author
Talend Documentation Team
EnrichVersion
6.5
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
task
Design and Development > Designing Jobs
EnrichPlatform
Talend CommandLine
Talend Studio
Use the DEFAULT_CONTEXT to specify the default context, and use the ContextType {} function to define contexts and their parameters.

ContextType {} properties

Function/parameter Description Mandatory?
NAME

Give a name to the context.

Yes

addContextParameter {}

Define a variable for the context. Use this function to define as many variables as needed.

  • NAME: Give a name to the variable.

  • TYPE: Specify the type of the variables. Acceptable values:

    • id_Boolean
    • id_Character
    • id_Date
    • id_Double
    • id_Float
    • id_Integer
    • id_Long
    • id_Short
    • id_String
    • id_Object
    • id_BigDecimal
    • id_File
    • id_Directory
    • id_List Of Value
    • id_Password
  • VALUE: Type in the value of the variables.
  • COMMENT: Type in a text comment.
  • PROMPT: Type in the prompt message.
  • PROMPTNEEDED: Set this parameter to true to trigger a prompt for this variable at Job execution.

Yes

Example

The following Job script example defines two contexts: Test (default context) and Prod, each with one variable named child_job of type String. For context Test, the predefined variable value is child_1, while for context Prod it is child_2. When the Job is executed, a text message Specify the Job to run: is displayed.

DEFAULT_CONTEXT: Test,
ContextType {
	NAME: Test
	addContextParameter {
		NAME: child_job,
		TYPE: "id_String",
		VALUE: "child_1",
		PROMPT: "Specify the Job to run:",
		PROMPTNEEDED: true
	}
}
ContextType {
	NAME: Prod
	addContextParameter {
		NAME: child_job,
		TYPE: "id_String",
		VALUE: "child_2",
		PROMPT: "Specify the Job to run:",
		PROMPTNEEDED: true
	}
}