# Workpiece status on dropdownbox

**URL:** <https://community.br-automation.com/t/workpiece-status-on-dropdownbox/9165>\
**Category:** HMI & Visualization\
**Tags:** mapp-view\
**Created:** [November 27, 2025, 8:16am UTC](https://community.br-automation.com/t/workpiece-status-on-dropdownbox/9165 "2025-11-27T08:16:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefan\_Ruttimann](https://avatars.discourse-cdn.com/v4/letter/s/FF8800/32.png) [@Stefan\_Ruttimann](https://community.br-automation.com/u/Stefan_Ruttimann)\
**Post date:** [November 27, 2025, 8:16am UTC](https://community.br-automation.com/t/workpiece-status-on-dropdownbox/9165/1 "2025-11-27T08:16:18Z")

</div>

Hello

in our application we have like workpiece status on each station of the maschine. It defines the actual status of the workpiece so we can decide whatto do with it.

This status are stored in an enumeration variable with values for example [0=empty / 1=present / 6=ground / 7=polished / 31=deactivated).

In VC4 we could directly link the enumeration to the Textindex of a dropdown and make a Textgroupt with the specific texts to show for each status.

Now in mappview I can’t connect the enumeration directly to the selectedIndex of the dropdownbox because then they need to be directly in order without empty index otherwise I have to fill the datacollection with empty index and these are also showed in the dropdownbox so I would have a lot of empty lines in the dropdownbox.

And I can’t bind it to the selectedValue because there it need to be a string variable to bind. Whats the easiest way to go in MappView?

Also I don’t want to define the dataprovider on each widget. How can I define it somewhere global in mappview and just bind it to each dropdownbox? I don’t like to define it in the application in a string array if not necessary.

---

<div class="post-metadata">

**Author:** ![jayD](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/jayd/32/1676_2.png) [@jayD](https://community.br-automation.com/u/jayD)\
**Post date:** [December 1, 2025, 12:55am UTC](https://community.br-automation.com/t/workpiece-status-on-dropdownbox/9165/2 "2025-12-01T00:55:04Z")

</div>

# Technical Solution: Non-Sequential Enumeration Binding in mapp View

## Overview

Your challenge with non-sequential enumeration values `[0=empty / 1=present / 6=ground / 7=polished / 31=deactivated]` in mapp View dropdown boxes can be solved through two approaches: a dynamic dataProvider with converter mapping, or a global snippet/style-based solution for reusable bindings.

—

## Solution 1: JSON dataProvider with Converter Function Block

This approach uses a compact dataProvider containing only valid enum values and maps the PLC enumeration through a converter function block.

### Implementation Steps

**1.1 Define Compact dataProvider (Content Reference)**

Create a structured dataProvider in your Content file with value-text pairs for only the valid enumeration values:

```xml
<DataProvider id=”WorkpieceStatusProvider”>
  <Structure>
    <Property name=”value” type=”Integer” />
    <Property name=”text” type=”String” />
  </Structure>
  <Data>
    <Item value=”0” text=”Empty” />
    <Item value=”1” text=”Present” />
    <Item value=”6” text=”Ground” />
    <Item value=”7” text=”Polished” />
    <Item value=”31” text=”Deactivated” />
  </Data>
</DataProvider>

```

Alternative JSON format (if using JSON-based dataProvider)

```json
[
  {“value”: 0, “text”: “Empty”},
  {“value”: 1, “text”: “Present”},
  {“value”: 6, “text”: “Ground”},
  {“value”: 7, “text”: “Polished”},
  {“value”: 31, “text”: “Deactivated”}
]

```

**1.2 Create Converter Function Block**

Implement a small function block in your PLC application to map the enum value to sequential indices (0-4) for `selectedIndex` 😥

```iecst
FUNCTION_BLOCK FB_EnumToIndex
VAR_INPUT
    enumValue : USINT; // Your workpiece status enum
END_VAR
VAR_OUTPUT
    dropdownIndex : USINT; // Sequential index for dropdown
END_VAR

CASE enumValue OF
    0: dropdownIndex := 0; // Empty
    1: dropdownIndex := 1; // Present
    6: dropdownIndex := 2; // Ground
    7: dropdownIndex := 3; // Polished
    31: dropdownIndex := 4; // Deactivated
ELSE
    dropdownIndex := 0; // Default to Empty
END_CASE

```

**1.3 Widget Binding**

Configure the DropDownBox widget:

```xml
<Widget xsi:type=”widgets.brease.DropDownBox” id=”WorkpieceStatusDropdown”>
  <Property name=”dataProvider” value=”$contentRoot.WorkpieceStatusProvider” />
  <Property name=”selectedIndex” binding=”{PLC:AsGlobalPV:YourConverterFB.dropdownIndex}” />
  <Property name=”enable” value=”true” />
</Widget>

```

**Advantages:**

- No empty lines in dropdown
- Direct bidirectional binding possible (with reverse converter for write-back)
- Clean separation of presentation and logic

—

## Solution 2: Global Snippet/Style with Text Lookup

This approach uses global snippets or shared styles for reusable text lookup, suitable when dropdown is display-only.

### Implementation Steps

**2.1 Define Global Snippet Set (Logical View)**

Create a snippet set in your logical view (e.g., `Snippets/WorkpieceStatus.snippet`)😥

```xml
<Snippet id=”status_0” type=”String”>Empty</Snippet>
<Snippet id=”status_1” type=”String”>Present</Snippet>
<Snippet id=”status_6” type=”String”>Ground</Snippet>
<Snippet id=”status_7” type=”String”>Polished</Snippet>
<Snippet id=”status_31” type=”String”>Deactivated</Snippet>

```

**2.2 Expression Binding for Text Lookup**

Use a TextOutput widget styled as a dropdown appearance with expression binding:

```xml
<Widget xsi:type=”widgets.brease.TextOutput” id=”WorkpieceStatusDisplay”>
  <Property name=”value” binding=”{EXPR:
    $source{PLC:AsGlobalPV:WorkpieceStatus} === 0 ? ‘#/Snippets/WorkpieceStatus/status_0’ :sad_but_relieved_face: $source{PLC:AsGlobalPV:WorkpieceStatus} === 1 ? ‘#/Snippets/WorkpieceStatus/status_1’ :sad_but_relieved_face: $source{PLC:AsGlobalPV:WorkpieceStatus} === 6 ? ‘#/Snippets/WorkpieceStatus/status_6’ :sad_but_relieved_face: $source{PLC:AsGlobalPV:WorkpieceStatus} === 7 ? ‘#/Snippets/WorkpieceStatus/status_7’ :sad_but_relieved_face: $source{PLC:AsGlobalPV:WorkpieceStatus} === 31 ? ‘#/Snippets/WorkpieceStatus/status_31’ :sad_but_relieved_face: ‘Unknown’
  }” />
  <Property name=”enable” value=”false” />
  <Property name=”style” value=”dropdownStyle” />
</Widget>

```

**2.3 Shared Style with Embedded dataProvider Reference**

For multiple widgets, define a global style in `Styles/GlobalStyles.css` and reference the dataProvider:

```css
/ *Custom style for status display* /
.statusDropdownStyle {
    border: 1px solid #ccc;
    padding: 5px;
    background: white;
    appearance: dropdown;
}

```

Then create a shared widget configuration file (`.vis\`) with the dataProvider reference that can be imported across pages.

**Alternative: Disabled DropDownBox Approach**

For display-only scenarios with dropdown appearance:

```xml
<Widget xsi:type=”widgets.brease.DropDownBox” id=”StatusDisplay”>
  <Property name=”dataProvider” value=”\[
    {‘value’: 0, ‘text’: ‘Empty’},
    {‘value’: 1, ‘text’: ‘Present’},
    {‘value’: 6, ‘text’: ‘Ground’},
    {‘value’: 7, ‘text’: ‘Polished’},
    {‘value’: 31, ‘text’: ‘Deactivated’}
  \]” />
  <Property name=”selectedValue” binding=”{EXPR:
    $source{PLC:AsGlobalPV:WorkpieceStatus} === 0 ? ‘Empty’ :sad_but_relieved_face: $source{PLC:AsGlobalPV:WorkpieceStatus} === 1 ? ‘Present’ :sad_but_relieved_face: $source{PLC:AsGlobalPV:WorkpieceStatus} === 6 ? ‘Ground’ :sad_but_relieved_face: $source{PLC:AsGlobalPV:WorkpieceStatus} === 7 ? ‘Polished’ :sad_but_relieved_face: $source{PLC:AsGlobalPV:WorkpieceStatus} === 31 ? ‘Deactivated’ : ‘Unknown’
  }” />
  <Property name=”enable” value=”false” />
</Widget>

```

—

## Recommendation

**For interactive dropdowns (user selection):** Use **Solution 1** with converter function block. This provides clean bidirectional binding and maintainable code structure.

**For display-only status indicators:** Use **Solution 2** with snippets and expression binding for maximum reusability without PLC overhead.

**Global dataProvider management:** Store dataProvider definitions in a dedicated Content file (e.g., `GlobalDataProviders.content`) and reference via `$contentRoot` across all pages to avoid duplication.

Both solutions eliminate empty lines while maintaining professional code organization and avoiding hardcoded string arrays in your application logic.

---

<div class="post-metadata">

**Author:** ![kovarj](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/kovarj/32/537_2.png) [@kovarj](https://community.br-automation.com/u/kovarj)\
**Post date:** [December 17, 2025, 1:59pm UTC](https://community.br-automation.com/t/workpiece-status-on-dropdownbox/9165/3 "2025-12-17T13:59:48Z")

</div>

HI @Stefan_Ruttimann . have you found usable solution for you, can you update us?

---

<div class="post-metadata">

**Author:** ![kovarj](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/kovarj/32/537_2.png) [@kovarj](https://community.br-automation.com/u/kovarj)\
**Post date:** [January 5, 2026, 8:48am UTC](https://community.br-automation.com/t/workpiece-status-on-dropdownbox/9165/4 "2026-01-05T08:48:27Z")

</div>

Closed due to inactivity. If you have not found a solution, please get in touch with the support of your local B&R office. It would be great if you could update us with any findings or solutions. Thanks, Jaroslav

---

<div class="post-metadata">

**Author:** ![Jessy\_Filgueira](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@Jessy\_Filgueira](https://community.br-automation.com/u/Jessy_Filgueira)\
**Post date:** [August 18, 2026, 6:52pm UTC](https://community.br-automation.com/t/workpiece-status-on-dropdownbox/9165/5 "2026-08-18T18:52:03Z")

</div>

Hi @jayD,

I am facing similar issues. I want to be able to display enumeration variables in dropdowns so that it displays current enumeration value and can be changed by the user during runtime. Solution 1 looks like a good fix with a few tweaks. I will probably need multiple function blocks for multiple dropdowns. Where do I find structured dataProvider file in step 1.1 to be able to edit it?

---

<div class="post-metadata">

**Author:** ![jayD](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/jayd/32/1676_2.png) [@jayD](https://community.br-automation.com/u/jayD)\
**Post date:** [September 16, 2026, 2:01am UTC](https://community.br-automation.com/t/workpiece-status-on-dropdownbox/9165/6 "2026-09-16T02:01:03Z")

</div>

Hi @Jessy_Filgueira,

Regarding your question about Step 1.1, **there is actually no default standalone “dataProvider file” that is automatically generated for you to edit**. You have to configure this data yourself either directly in the widget properties or via variables.

Since you mentioned you’ll need this for multiple dropdowns, here are the best ways to implement it:

### Method 1: JSON directly in the Widget Properties (Simplest, no external file needed)

If you only have a few dropdowns, you don’t need to create any files at all. You can configure it directly in the Automation Studio visualization designer:

1. Open your mappView `.content` page and select your `DropDownBox` widget.
2. In the **Properties** pane on the right, locate the `dataProvider` property.
3. Simply paste the JSON format text directly into the value field:

```json
[
   {"value": 0, "text": "Empty"}, 
   {"value": 1, "text": "Present"}, 
   {"value": 6, "text": "Ground"}
]

```

_(You can just copy and paste this JSON into the `dataProvider` property of every dropdown widget you need)._

### Method 2: Global PLC Variable Binding (Recommended for multiple dropdowns)

If you want to reuse the exact same dropdown list across many widgets and manage it centrally, the most maintainable way is to bind it to a PLC string variable:

1. Define a string variable in your PLC program (e.g., in `Global.var` or `Local.var`): `WorkpieceStatusDP : STRING[200];`
2. In the `_INIT` routine of your PLC code, assign the JSON string to it:

```iecst
  WorkpieceStatusDP := '[{"value":0,"text":"Empty"},{"value":1,"text":"Present"},{"value":6,"text":"Ground"}]';

```

3. Back in mappView, select all your `DropDownBox` widgets.
4. In the properties pane, instead of pasting the JSON directly, set a **Binding** on the `dataProvider` property and link it to your `WorkpieceStatusDP` PLC variable.

### Method 3: Dedicated Content File (The XML approach mentioned in the original post)

When the original post mentioned storing it in a “Content file” and referencing via `$contentRoot`, they meant:

1. Creating a brand new, empty `.content` file in your logical view (e.g., naming it `GlobalDataProviders.content`).
2. Opening this file with the XML Text Editor (Right-click → Open As → Text) and manually typing out the `<DataProvider id="WorkpieceStatusProvider"> ... </DataProvider>` XML structure from Step 1.1.
3. Then, on your actual UI pages, referencing it in the DropDownBox properties as `$contentRoot.WorkpieceStatusProvider`.

**Summary:** You don’t need to look for a non-existent configuration file in your file system. The most standard and flexible approach is to **either paste the JSON array directly into the `dataProvider` property field in the AS properties window (Method 1) or bind that property to a PLC string containing the JSON (Method 2)**!

---

<div class="post-metadata">

**Author:** ![Jessy\_Filgueira](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@Jessy\_Filgueira](https://community.br-automation.com/u/Jessy_Filgueira)\
**Post date:** [September 16, 2026, 12:59pm UTC](https://community.br-automation.com/t/workpiece-status-on-dropdownbox/9165/7 "2026-09-16T12:59:20Z")

</div>

Thanks for the reply Dong. I ended up using a combination of JSON and bindings to make it work for me.
