---
title: Use the Combination Processor Function
slug: manufacturing-connect-edge-v2/use-the-combination-processor-function
docTags: 
createdAt: 2024-05-24T20:18:27.662Z
---

You can use the Combination processor function to combine fields from different input processors into a single JSON string.

# Understanding Combination Types

You have the following combination types:

- **Combine selected fields:** This option allows you to combine the selected number of fields from different input processors into a single JSON string.&#x20;
- **Combine all fields:** This option allows you to combine all fields from different input processors into a single JSON string.&#x20;

# User Scenario

Review the following scenario for the combination processor function. Then, you will simulate PLC data and create combinations using input processors.

In your manufacturing plant, various PLCs control the production process for assembly lines, robotic arms, conveyor belts, and environmental controls. With the Combination Processor, you can merge the data from multiple or all PLCs into a single JSON string to get a complete view of the plant's operations.

# Step 1: Add a Device

Follow the steps to [Connect a Device](docId\:SqalV8ImyZmn8xA-56gno) and configure the following parameters:

- **Device Type**: Simulator
- **Driver Name**: Generator
- **Enable Alias Topics**: Select the checkbox.&#x20;

# Step 2: Add Tags

After connecting the device, add the following tags. See [Add Tags](docId:-5nFrBQ-uriWOY3GACnPt) to learn more. Each tag will represent one of the combination types mentioned above.

## Tag 1: Combine\_selected\_fields

- **Name**: Select **S - Random value generator**
- **Value Type:** Select **int64**
- **Polling Interval**: Enter **5**
- **Tag Name**: Enter **Combine\_selected\_fields**

## Tag 2: Combine\_all\_fields

- **Name**: Select **S - Random value generator**
- **Value Type:** Select **int64**
- **Polling Interval**: Enter **5**
- **Tag Name**: Enter **Combine\_all\_fields**

# Step 3: Create Analytics Flows

You can now create the analytics flows using data from the device and tags you previously created. Follow the steps for either Step 3a or 3b, depending on whether you want to combine selected or all fields.&#x20;

**To create an analytics flow with the Combination Processor function:**

1. Navigate to **Analytics**. &#x20;
2. On the analytics canvas, click **Add processor**.
   The *Create a processor&#x20;*&#x64;ialog box displays.
   ![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/QMI96mDCTPJarVhIlUJlG_image.png "The Add processor option")
3. Select **DataHub Subscribe**.
4. In the *Topic&#x20;*&#x66;ield, click the **Search&#x20;**&#x69;con, select the device you previously created, and then select the alias topic for the **Combine\_selected\_fields&#x20;**&#x74;ag.
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/Uf1FGFSNwvHhOjU47Xcre_image.png" size="80" width="1141" height="571" position="center" caption="Create a Processor dialog box" showCaption="true"}
5. Click **Save**.
6. Repeat steps 2-5 to add another *DataHub Subscribe* node. Select the alias topic for the **Combine\_all\_fields&#x20;**&#x74;ag.&#x20;

## &#x20;Step 3a: Configure JSON String for Selected Fields

1. Click **Add processor** again and select **Combination Processor**.
   The following information defines this function:
   - **Combination Type:** Select **combine selected fields** from the drop-down menu.
   - **What Timestamp to Take?:&#x20;**&#x53;elect **fresh timestamp** from the drop-down menu.
   - **Fields to Combine:&#x20;**&#x54;he fields to combine are defined a&#x73;**&#xA0;wire definition\_fieldName.&#x20;**&#x45;nter **combineselect\_tagName, combineselect\_value, combineall\_tagName, combineall\_value,&#x20;**&#x77;ith a comma as the separator.
2. Click **Save**.
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/HJ0cpkhJatCEWLxq7S5cb_image.png" size="80" width="568" height="491" position="center" caption="Combination Pocessor dialog box" showCaption="true"}
3. Connect the DataHub Subscribe processor (tag: *Combine\_selected\_fields)* to the Combination processor with a wire and enter the definition of **combineselect&#x20;**&#x66;or the connection.
4. Connect the DataHub Subscribe processor (tag: *Combine\_all\_fields*) to the Combination processor with a wire and enter a definition of **combineall&#x20;**&#x66;or the connection.
5. On the analytics canvas, click **Save**.

## Step 3b: Configure JSON String for All Fields

1. Click **Add processor** again and select **Combination Processor**.
   The following information defines this function:
   - **Combination Type:** Select **combine all fields** from the drop-down menu.
   - **What Timestamp to Take?:&#x20;**&#x53;elect **fresh timestamp** from the drop-down menu.
   - **Fields to Combine:&#x20;**&#x59;ou may skip this field for this combination type.
2. Click **Save**.
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/XNbORZsTSa8mOmnUEdiij_image.png" size="80" width="581" height="615" position="center" caption="Combination Pocessor dialog box" showCaption="true"}
3. Connect the DataHub Subscribe processor (tag: *Combine\_selected\_fields)* to the Combination processor with a wire and enter the definition of **combineselect&#x20;**&#x66;or the connection.
4. Connect the DataHub Subscribe processor (tag: *Combine\_all\_fields*) to the Combination processor with a wire and enter a definition of **combineall&#x20;**&#x66;or the connection.
5. On the analytics canvas, click **Save**.

The configured analytics flows should look like the following after completing either Step 3a or Step 3b.

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/gEOf5rXi3cbZ_ABGsrxlA_image.png" size="80" width="722" height="411" position="center" caption="Completed Analytics Flow" showCaption="true"}

# Step 4: View Output of Processor

Click the **View&#x20;**&#x69;con in the *Combination* processor to view combined field JSON strings on the analytics canvas.

## View Combined JSON String for Selected Fields

The *Combination&#x20;*&#x70;rocessor returns a JSON string with the fields `combineselect_tagName`, `combineselect_value`, `combineall_tagName`, and `combineall_value`.

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/vDg-UkJ1sW_dUrBh2ey0O_image.png" size="80" width="981" height="784" position="center" caption="Selected Fields in Output" showCaption="true"}

## View Combined JSON String for All Fields

The *Combination&#x20;*&#x70;rocessor returns the full JSON string with all the fields from both input processors.

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/vzWdtmv9AQUKdjjj3LdWx_image.png" size="80" width="980" height="912" position="center" caption="All Fields in Output" showCaption="true"}

