---
title: "Enclosing Chart Block"
id: "enclosing-chart-block"
project: "MES User Manual"
url: "https://docs.sepasoft.com/articles/user-manual/enclosing-chart-block"
updated: 2026-07-31T14:56:57Z
---

# Enclosing Chart Block

**Sepasoft MES Module Suite**
 ![](/resources/Storage/user-manual/enclosing-chart-block/Block%20Icons%20-%20Enclosing%20Chart.png)

Description

The **Enclosing Chart Block** allows users to nest ('enclose') and execute other charts within the current chart. Mapping allows Chart Parameter values (including B2MML and complex) to be passed to and from the enclosed chart.

 Connections

Two connections are required:

**Input** — (input) Receives execution control from the previous Block in the sequence and passes it to the Start Block of the enclosed chart (one of your other charts, which is selected in the **Enclosed Chart** property field). Unlimited input connections are allowed (spread across up to three available edges).

**Output** — (output) Execution control passes back from the End Block in the enclosed chart and out to the Block connected to the **Output** connection.

 Properties

The optional **Name** and **Description** fields are included on most Blocks for clarity and documentation benefit.

One of the other available charts in the project is selected to be the 'enclosed' chart.

![](/resources/Storage/user-manual/enclosing-chart-block/Enclosing%20Chart%20-%20Property%20Pane.PNG)

### Mapping Parameters

The Mapping pane allows Chart Parameter values (including B2MML and complex) to be passed to and from the enclosed chart. The schemas of all defined Chart Parameters for both the chart containing the Enclosing Chart Block and the enclosed chart will become available for mapping.

Mapping Mismatched Data Types

| ![Warning](/resources/Storage/user-manual/user-manual/Warning.png) | The mapper  allow you to map together parameters with mismatched data types, but you must do the appropriate type conversion in a script function at the receiving parameter.<br><br>Example: For mapping the string parameter ***apples\_string*** to the integer parameter ***enclosed\_chart\_apples***, a one-line script function ( ![](/resources/Storage/user-manual/enclosing-chart-block/Script%20Function%20Icon.PNG)) is added to the ***enclosed\_chart\_apples*** parameter to do the data type conversion, as shown below:<br><br>![](/resources/Storage/user-manual/enclosing-chart-block/Mapping%20example.PNG)<br><br>![](/resources/Storage/user-manual/enclosing-chart-block/Mapping%20example%202_1x.png) |
| --- | --- |

### Passing Chart Parameter to the Enclosed Chart

In this example, the Chart Parameter ***main\_in*** will be passed to the enclosed chart's ***enclosed\_in*** Chart Parameter (data types must match):

![](/resources/Storage/user-manual/enclosing-chart-block/Enclosing%20Chart%20Block%20-%20Mapping%20-%20Input.PNG)

### Passing Chart Parameter to the 'Parent' Chart

In this example, the enclosed chart's ***enclosed\_out*** Chart Parameter will be passed to the 'parent' chart's ***main\_out*** Chart Parameter (data types must match):

![](/resources/Storage/user-manual/enclosing-chart-block/Enclosing%20Chart%20Block%20-%20Mapping%20-%20Output.PNG)

### Schema Refreshing and Changes
Clicking the **Refresh** ( ![](/resources/Storage/user-manual/refresh-button-for-action-blocks/Refresh%20Button%20for%20Action%20Blocks.PNG)) button will cause a re-fetch of both the input and output schemas. If both schemas still match what is currently selected for each in the Block, then a "**Confirm**" dialog box will appear.

* Clicking **Yes** will cause the Block to fetch fresh data.
* Clicking **No** will abort the refresh.

If either schema has been edited, an "**Outdated Mapping**" dialog box will immediately appear (without the need to press **Refresh**), with two choices on how to handle the schema mismatch, plus **Cancel**.

* Clicking **Continue** will apply all the mappings that are still valid and clean up the outdated mappings.
* Clicking **Reset** will clear all the saved data and mapping connections and then fetch a fresh copy of both schemas.
* Clicking **Cancel** will abort the refresh, allowing the user to manually fix the schema without losing saved data.
![](/resources/Storage/user-manual/refresh-button-for-action-blocks/Refresh%20Confirmation%20Dialog%20Box.PNG)

![](/resources/Storage/user-manual/refresh-button-for-action-blocks/Continue-Reset-Cancel%20Dialog%20Box.PNG)

 Usage

## Connecting the Enclosing Chart Block

1. Drag an **Enclosing Chart Block** onto the Design Grid (position to be the next block in the chart sequence).
2. Click on the previous Block in the sequence and draw a Connector to the Enclosing Chart Block (any available edge). This becomes the **Input** connection. Repeat for any additional input Blocks, if applicable (unlimited connections are allowed on up to three edges).
3. Click on the Enclosing Chart Block and draw a Connector (from any available edge) to the next Block in the sequence. This becomes the **Output** connection.

## Selecting an Enclosed Chart

1. Select one of your other charts from the **Enclosed Chart** drop-down list (must already exist in order to appear in the list).
![](/resources/Storage/user-manual/enclosing-chart-block/Enclosed%20Chart%20property.PNG)

## Mapping Chart Parameters

1. In the **Input** tab, drag a connector arrow to connect a Chart Parameter in the 'parent' chart to a Chart Parameter in the enclosed chart (data types must match). Repeat for any other parameters to be passed.
2. In the **Output** tab, drag a connector arrow to connect a Chart Parameter in the enclosed chart to a Chart Parameter in the 'parent' chart (data types must match). Repeat for any other parameters to be passed.

 Example

## Enclosing Chart

 This example chart contains an Enclosing Chart block with an enclosed chart. As shown below, a single data value is passed in from an Ignition Button script, passed into the enclosed chart, doubled, then passed back out to the main chart and back to the button script, demonstrating how parameters values can be passed to/from a chart and to/from an enclosed chart.

![](/resources/Storage/user-manual/example-enclosing-chart/Diagram_1x.png)
 * * *
 ### Chart Hierarchy

The chart, ***Main Chart***, contains an Enclosing Chart Block, which 'encloses' the chart ***Enclosed Chart***:

![](/resources/Storage/user-manual/example-enclosing-chart/Main%20Chart.PNG)

The enclosed chart, ***Enclosed Chart***, contains a Script Block, which reads the value of the Chart Parameter ***enclosed\_in***, multiplies it by 2, then writes the result to ***enclosed\_out***.

![](/resources/Storage/user-manual/example-enclosing-chart/Enclosed%20Chart.PNG)

![](/resources/Storage/user-manual/example-enclosing-chart/Enclosed%20Chart%20-%20Script%20Block.PNG)

* * *

### Start Block - Main Chart

The Start Block in ***Main Chart*** has two Chart Parameters defined (type Integer):

![](/resources/Storage/user-manual/example-enclosing-chart/Main%20Chart%20-%20Start%20Parameters.PNG)

### Start Block - Enclosed Chart

The Start Block in ***Enclosed Chart*** also has two Chart Parameters defined (type Integer):

![](/resources/Storage/user-manual/example-enclosing-chart/Enclosed%20Chart%20-%20Start%20Parameters.PNG)

* * *

### Mapping

The **Input** tab maps what parameters from the 'parent' chart will get passed down into the selected enclosed chart. In this example, the Chart Parameter ***main\_in*** in ***Main Chart*** is mapped to the Chart Parameter ***enclosed\_in*** in ***Enclosed Chart***. When execution control is about to pass 'into' the Enclosing Chart Block, the current value of ***main\_in*** will first get passed into ***enclosed\_in*** in ***Enclosed Chart***:

![](/resources/Storage/user-manual/example-enclosing-chart/Enclosing%20Chart%20Block%20-%20Mapping%20-%20Input.PNG)

The **Output** tab maps what parameters from the enclosed chart will get passed back up to the 'parent' chart. In this example, the Chart Parameter ***enclosed\_out*** in ***Enclosed Chart*** is mapped to the Chart Parameter ***main\_out*** in ***Main Chart***. When execution control is about to pass back up to the chart ***Main Chart***, the current value of ***enclosed\_out*** will first get passed into ***main\_out*** in ***Main Chart***:

![](/resources/Storage/user-manual/example-enclosing-chart/Enclosing%20Chart%20Block%20-%20Mapping%20-%20Output.PNG)

* * *

### Button Script

A simple script is written to the **actionPerformed** event handler of the '***Multiply by 2***' button, which reads a user-input value from the **Text Field** component and passes it into ***Main Chart*** , waits for the Python dictionary, ***r***, to be returned, retrieves the value for ***main\_out*** from it and finally writes it to the **LED Display** component.

![](/resources/Storage/user-manual/example-enclosing-chart/image2019-4-23_16-2-1.png)

![](/resources/Storage/user-manual/example-enclosing-chart/Button%20Script.PNG)

**Sepasoft MES Module Suite**