# Adding Blocks to a Sub Task

A Sub Task block can be created in two ways: dragging and dropping a Sub Task block into the Task from the Toolbox, or selecting one or more blocks in a Task and selecting Create Sub Task from the right-click menu.

Note: Sub Task blocks can be nested within other Sub Task blocks.

- When dragging and dropping a Sub Task block into the Task from the Toolbox, a new, empty Sub Task will be created.

  Blocks can then be dragged and dropped into the Sub Task from the Toolbox. See the Configuring a Sub Task Block topic for more information about adding pins to the Sub Task input and output blocks.

- Alternatively, blocks in a Task (or even another Sub Task) can be selected by either holding down the Ctrl Key and left-clicking the mouse on individual blocks, or dragging and holding the left-click button of the mouse over a selection of blocks. Then, right-click and select Create Sub Task to automatically populate a Sub Task.

  The selected blocks will be extracted from their current location, and placed into the Sub Task with all of their input and output pins intact.

  The Sub Task will also maintain any links that existed between the blocks in the Sub Task and the Task they were extracted from.

Note:

When extracting blocks, ensure that the order of execution (left-to-right) is maintained. The Designer application will warn you if you are creating an unresolved loop, however, you have the ability to override the warning message.

For example, if you had a set of blocks as shown below, and attempted to extract the Or and XOR blocks into a Sub Task:

You will create a broken loop, because the Or and XOR blocks rely on the execution of the Not1 block, which was not incorporated into the Sub Task.