////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////
:documentationPath: /workflow/actions/
:language: en_US
:description: The Set variables action sets variables at various scopes.
:openvar: ${
:closevar: }

= Set variables

== Description

The `Set variables` action sets variables at various scopes.

== Options

[options="header", width="90%". cols="1,3"]
|===
|Option|Description
2+|Properties file
|Workflow action name|The name of the workflow action.
|Name of properties file|The name of the properties file.
|Variable scope a|
* Valid in the Java Virtual machine
* Valid in the current workflow
* Valid in the parent workflow
* Valid in the root workflow
2+|Settings
|Variable substitution|Whether or not to substitute variables. Leave unchecked only if you actually want to set a literal value like `{openvar}MyVariable{closevar}` in the Value column.
|Variables|A list of variables to set to a certain value at a certain scope.
|===

== Working with Properties Files

Properties files are simple text files used to store key-value pairs. They are commonly used to manage configuration settings and variables outside of the codebase. In Apache Hop, a properties file can be used to set multiple variables at once in a workflow.

A properties file is a text file with the `.properties` extension. Each line in the file represents a key-value pair. The key and value can be separated by an equals sign (`=`), a colon (`:`), or whitespace characters.

== Variable substitution

The "Variable substitution" option allows you to dynamically create and set variables based on existing variable values. When enabled, any variable references in the variable name or value fields will be resolved before the variables are set. This enables the creation of new variables whose names and values depend on other variable contents, providing a flexible and dynamic approach to variable management within workflows. The syntax `{openvar}MyVariable{closevar}` is used to retrieve variable values.