Skip to main content Skip to complementary content
  • New archived content: Talend MDM, Talend Data Catalog 8.0, and Talend 7.3 products reached their end of life in 2024. Their documentation was moved to the Talend Archive page and will no longer receive content updates.
Close announcements banner

Defining contexts and variables in a Job script

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
	}
}

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!