# Extract Dynamic Substring from MQTT Tag Path in UDT Expression Tag Ignition 8.3.6

**URL:** <https://forum.inductiveautomation.com/t/extract-dynamic-substring-from-mqtt-tag-path-in-udt-expression-tag-ignition-8-3-6/115633>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [May 21, 2026, 9:52am UTC](https://forum.inductiveautomation.com/t/extract-dynamic-substring-from-mqtt-tag-path-in-udt-expression-tag-ignition-8-3-6/115633 "2026-05-21T09:52:21Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [May 21, 2026, 9:52am UTC](https://forum.inductiveautomation.com/t/extract-dynamic-substring-from-mqtt-tag-path-in-udt-expression-tag-ignition-8-3-6/115633/1 "2026-05-21T09:52:21Z")

</div>

I am using Ignition 8.3.6 with MQTT Engine. I have a UDT with a `Parameters` folder containing `tag1` which holds an MQTT tag path like:

[MQTT Engine]Mimics/iotdata/KCW/N-KCW1-CL1-J-PV-CL\_471FN7\_KW/value  
[MQTT Engine]Mimics/iotdata/GCW/W-GCW1-PH1-X-PV-J1P63\_X2/value  
[MQTT Engine]Mimics/iotdata/NMGD/W-NMGD1-CM1-F-COP-CM\_531WF1\_FR1/value

**What I Want:**

I have an **Expression Tag** called `Tag Name` inside the UDT. I want it to dynamically extract the **device prefix** from the path, which is the segment between the plant folder and the second dash:

| Full Path | Expected Output |
| --- | --- |
| `.../KCW/N-KCW1-CL1-...` | `N-KCW1-` |
| `.../GCW/W-GCW1-PH1-...` | `W-GCW1-` |
| `.../NMGD/W-NMGD1-CM1-...` | `W-NMGD1-` |

The plant folder name (KCW, GCW, NMGD etc.) and device suffix (`-CL1`, `-CM1`, `-PH1`) vary across instances, so the solution must be **fully dynamic**. Can it be done in ignition?

---

<div class="post-metadata">

**Author:** ![tgarrison](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tgarrison/32/80965_2.png) [@tgarrison](https://forum.inductiveautomation.com/u/tgarrison)\
**Post date:** [May 21, 2026, 12:50pm UTC](https://forum.inductiveautomation.com/t/extract-dynamic-substring-from-mqtt-tag-path-in-udt-expression-tag-ignition-8-3-6/115633/2 "2026-05-21T12:50:00Z")

</div>

yes. split and indexOf will need to become your friends. Check those expression functions out, and you should be able to get it worked out.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [May 21, 2026, 2:23pm UTC](https://forum.inductiveautomation.com/t/extract-dynamic-substring-from-mqtt-tag-path-in-udt-expression-tag-ignition-8-3-6/115633/3 "2026-05-21T14:23:26Z")

</div>

This is honestly not sustainable and will cause a nightmare further down the line when a site is introduced that does not have the exact same tag pathing.

I would instead add more parameters to the UDT and include a TagName or TagDescription parameter that could then be referenced in an expression tag inside the UDT i.e. {TagDescription}

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 21, 2026, 2:37pm UTC](https://forum.inductiveautomation.com/t/extract-dynamic-substring-from-mqtt-tag-path-in-udt-expression-tag-ignition-8-3-6/115633/4 "2026-05-21T14:37:03Z")

</div>

> [@prasoon](#):
>
> [MQTT Engine]Mimics/iotdata/KCW/N-KCW1-CL1-J-PV-CL\_471FN7\_KW/value

This is ugly without Phil's Integration Toolkit module.. But here goes

`split(split({value}, '/')[3,0]), '-')[0,0] + '-' + split(split({value}, '/')[3,0]), '-')[1,0] + '-' `

Or

`transform(split(split({value}, '/')[3,0], '-'), value()[0,0] + '-' + value()[1,0] + '-')`

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 21, 2026, 2:51pm UTC](https://forum.inductiveautomation.com/t/extract-dynamic-substring-from-mqtt-tag-path-in-udt-expression-tag-ignition-8-3-6/115633/5 "2026-05-21T14:51:17Z")

</div>

> [@nminchin](#):
>
> without Phil's Integration Toolkit

Hmm. No one should be without it. I would use:

```python
transform(
    split(
        qvAt(
            where(
                split(
                    parsePath(tag('[.]refTag.sourceTagPath'))[0, 'tag'],
                    '/'
                ),
                it()[0] != 'value'
            ),
            -1,
            0
        ),
        '-'
    ),
    stringFormat(
        "%s-%s-",
        value()[0, 0],
        value()[1, 0]
    )
)

```

Presumably the UDT parameter will drive the source path for a reference tag. Place this expression tag adjacent to that reference tag.

Robust against varying tree depth, ignores present or absent `/value`, and varying length elements of the prefix.

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [May 21, 2026, 3:58pm UTC](https://forum.inductiveautomation.com/t/extract-dynamic-substring-from-mqtt-tag-path-in-udt-expression-tag-ignition-8-3-6/115633/6 "2026-05-21T15:58:51Z")

</div>

> [@pturmel](#):
>
> Hmm. No one should be without it. I would use:
> 
> ```python
> transform(
> split(
> qvAt(
> where(
> split(
> parsePath(tag('[.]refTag.sourceTagPath'))[0, 'tag'],
> '/'
> ),
> it()[0] != 'value'
> ),
> -1,
> 0
> ),
> '-'
> ),
> stringFormat(
> "%s-%s-",
> value()[0, 0],
> value()[1, 0]
> )
> )
> 
> ```
> 
> Presumably the UDT parameter will drive the source path for a reference tag. Place this expression tag adjacent to that reference tag.
> 
> Robust against varying tree depth, ignores present or absent `/value`, and varying length elements of the prefix.

I applied your code in my expression tag, but no sucess.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/a/bae919389a8e33e70aa46cf12fb9c17f351e1301.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 21, 2026, 4:10pm UTC](https://forum.inductiveautomation.com/t/extract-dynamic-substring-from-mqtt-tag-path-in-udt-expression-tag-ignition-8-3-6/115633/7 "2026-05-21T16:10:29Z")

</div>

> [@prasoon](#):
>
> applied your code

You didn't use my `parsePath()` function at all. (Not so robust without it.)

Did you install my Integration Toolkit module? Won't work without it. And for some versions of v8.1, a gateway restart is needed for the functions to work in expression tags.

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [May 21, 2026, 4:30pm UTC](https://forum.inductiveautomation.com/t/extract-dynamic-substring-from-mqtt-tag-path-in-udt-expression-tag-ignition-8-3-6/115633/8 "2026-05-21T16:30:21Z")

</div>

> [@pturmel](#):
>
> You didn't use my `parsePath()` function at all. (Not so robust without it.)
> 
> Did you install my Integration Toolkit module? Won't work without it. And for some versions of v8.1, a gateway restart is needed for the functions to work in expression tags.

Hi Phil,

Thank you for your response! I am using Ignition v8.3.6. I was not aware of the Integration Toolkit module — that explains why your parsePath() function wasn't working in my case.

Could you please share the download link for the Integration Toolkit module compatible with v8.3.6? I would love to implement your more robust solution properly.

Thanks again for your help and time!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 21, 2026, 4:51pm UTC](https://forum.inductiveautomation.com/t/extract-dynamic-substring-from-mqtt-tag-path-in-udt-expression-tag-ignition-8-3-6/115633/9 "2026-05-21T16:51:01Z")

</div>

Bottom of this page:

> **[Automation Professionals](https://www.automation-pros.com/modulesales.html)**

More discussion/history here:

> [@Automation Professionals' Integration Toolkit Module](https://forum.inductiveautomation.com/t/automation-professionals-integration-toolkit-module/74934):
>
> Automation Professionals is pleased to announce the immediately availability of a major upgrade to its free Simulation Aids Integration Toolkit module. The new feature justifying the "major upgrade" language is the implementation of eleven thirty-one new expression functions which use iteration to accomplish complex transforms of datasets and lists, to or from other datasets and lists, applying filtering, ordering, and computed new columns along the way. While there are certain operations that…

User-contributed material here:

> [@Integration Toolkit Solutions Wiki](https://forum.inductiveautomation.com/t/integration-toolkit-solutions-wiki/105080):
>
> By popular request, I've created this topic to be used in wiki mode for collaborative generation of solutions to particular problems. To keep this neat, please follow these guidelines: New problems seeking solutions should be posted as replies, and the discussion of that problem kept within that comment, wiki-style. A one-line summary should be added to this topic starter, with an embedded link (not on its own line). After posting, be sure to convert the comment to operate in wiki mode.

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [May 21, 2026, 5:26pm UTC](https://forum.inductiveautomation.com/t/extract-dynamic-substring-from-mqtt-tag-path-in-udt-expression-tag-ignition-8-3-6/115633/10 "2026-05-21T17:26:54Z")

</div>

Thanks a lot, your script works after installing the tool.

---

<div class="post-metadata">

**Author:** ![prasoon](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@prasoon](https://forum.inductiveautomation.com/u/prasoon)\
**Post date:** [May 21, 2026, 5:27pm UTC](https://forum.inductiveautomation.com/t/extract-dynamic-substring-from-mqtt-tag-path-in-udt-expression-tag-ignition-8-3-6/115633/11 "2026-05-21T17:27:25Z")

</div>

Thanks your given code worked.
