Building a Data Flow
Also available as:
PDF

Variables Window

Variables can be created and configured within the NiFi UI. The variables can be used in any field that supports Expression Language. NiFi automatically picks up new or modified variables created in the UI.

To access the Variables window, right-click on the canvas with nothing selected:

Select "Variables" from the Context Menu:

"Variables" is also available in the right-click Context Menu when a process group is selected:

Creating a Variable

In the Variables window, click the "+" button to create a new variable. Add a name:

and a value:

Select "Apply":

Steps to update the variable are performed (Identifying components affected, Stopping affected Processors, etc.). For example, the Referencing Processors section now lists the "PutFile-Root" processor. Selecting the name of the processor in the list will navigate to that processor on the canvas. Looking at the properties of the processor, ${putfile_dir} is referenced by the Directory property:

Variable Scope

Variables are scoped by the Process Group they are defined in and are available to any Processor defined at that level and below (i.e. any descendant Processors).

Variables in a descendant group override the value in a parent group. More specifically, if a variable x is declared at the root group and also declared inside a process group, components inside the process group will use the value of x defined in the process group.

For example, in addition to the putfile_dir variable that exists at the root process group, assume another putfile_dir variable was created within Process Group A. If one of the components within Process Group A references putfile_dir, both variables will be listed, but the putfile_dir from the root group will have a strikethrough indicating that is is being overridden:

A variable can only be modified for the process group it was created in, which is listed at the top of the Variables window. To modify a variable defined in a different process group, select the "arrow" icon in that variable's row:

which will navigate to the Variables window for that process group:

Variable Permissions

Variable permissions are based solely on the privileges configured on the corresponding Process Group.

For example, if a user does not have access to View a process group, the Variables window can not be viewed for that process group:

If a user has access to View a process group but does not have access to Modify the process group, the variables can be viewed but not modified.

Referencing Controller Services

In addition to Referencing Processors, the Variables window also displays Referencing Controller Services:

Selecting the name of the controller service will navigate to that controller service in the Configuration window:

Unauthorized Referencing Components

When View or Modify privileges are not given to a component that references a variable, the UUID of the component will be displayed in the Variables window:

In the above example, the variable property1 is referenced by a processor that "user1" is not able to view: