# UDT Expression Tag Using OPC Tag Path Error

**URL:** <https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 15, 2025, 8:31pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823 "2025-12-15T20:31:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyler\_Dixon](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@Tyler\_Dixon](https://forum.inductiveautomation.com/u/Tyler_Dixon)\
**Post date:** [December 15, 2025, 8:31pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823/1 "2025-12-15T20:31:24Z")

</div>

I am trying to use a UDT to read several Modbus registers, perform a calculation and return a value. Please see code below. Returns a “Error\_Configurtion“ message. I feel it is simple or I just don’t have the correct Expression for the tag path to the OPC device.ModbusRegister. Any suggestions?

// Current Unbalance Formula  
(  
// Calculate Absolute Maximum Deviation of Phase Currents  
(max(abs([{deviceName}]{unitId}.HRUS577 - [{deviceName}]{unitId}.HRUS580),  
abs([{deviceName}]{unitId}.HRUS578 - [{deviceName}]{unitId}.HRUS580),  
abs([{deviceName}]{unitId}.HRUS579 - [{deviceName}]{unitId}.HRUS580))  
)  
// Divide by Current Average Magnitude \* 100 for %  
/  
[{deviceName}]{unitId}.HRUS580  
)\*100

 ![UDT-Expression](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/6/66d8d2dc35d75d24a954c3096ce90d90cbdb7731.png)

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [December 15, 2025, 8:33pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823/2 "2025-12-15T20:33:44Z")

</div>

~~You aren't actually referencing the tags. This is the one rare case where the usage of `tag()` in an expression is allowable. You'll need to rebuild how you construct the dynamic paths to be strings, and place them each inside of `tag()`.~~

Edit: seems like everyone's reading comprehension is off, or I need more coffee. You cannot do what you are trying in an expression tag.

---

<div class="post-metadata">

**Author:** ![Tyler\_Dixon](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@Tyler\_Dixon](https://forum.inductiveautomation.com/u/Tyler_Dixon)\
**Post date:** [December 15, 2025, 8:44pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823/3 "2025-12-15T20:44:51Z")

</div>

But how does the tag() expression handle OPC UA Server paths? For this instance of my UDT, I have set up 4x unique parameters to use as a template. The deviceName references the Modbus TCP device on the gateway and the unitId references the Modbus ID.

 ![UDT-Parameters](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/9/c970177c8129d5da8f3b5eb6d136af653b9b7e87.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:** [December 15, 2025, 8:45pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823/4 "2025-12-15T20:45:12Z")

</div>

No, this is not a task for `tag()`.

Make actual member tags in the UDT of type OPC with those parameterized OPC Item Paths.

Then the expression can reference them as `{[.]SomeTag}`.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [December 15, 2025, 8:46pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823/5 "2025-12-15T20:46:00Z")

</div>

> [@pturmel](#):
>
> No, this is not a task for `tag()`.

Yup, I realized that after posting, I saw them as other tags in ignition when I first read through.

---

<div class="post-metadata">

**Author:** ![Tyler\_Dixon](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@Tyler\_Dixon](https://forum.inductiveautomation.com/u/Tyler_Dixon)\
**Post date:** [December 15, 2025, 8:55pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823/6 "2025-12-15T20:55:24Z")

</div>

Still returning “Error\_Configuration”

// Current Unbalance Formula  
(  
// Calculate Absolute Maximum Deviation of Phase Currents  
(max(abs({[.]CurrA} - {[.]CurrAvg},  
abs({[.]CurrB} - {[.]CurrAvg}),  
abs({[.]CurrC} - {[.]CurrAvg}))  
)  
// Divide by Current Average Magnitude \* 100 for %  
/  
{[.]CurrAvg}  
)\*100

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [December 15, 2025, 8:58pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823/7 "2025-12-15T20:58:06Z")

</div>

Please post code as preformatted text, it preserves whitespace and syntax highlighting, see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831). You can edit your post by clicking the pencil icon in the bottom right.

To me it looks like your first `abs` is missing its ending enclosing paranthesis (adjusted for better readability):

```python
// Current Unbalance Formula
// Calculate Absolute Maximum Deviation of Phase Currents
(max(
	abs({[.]CurrA} - {[.]CurrAvg}),
	abs({[.]CurrB} - {[.]CurrAvg}),
	abs({[.]CurrC} - {[.]CurrAvg})
// Divide by Current Average Magnitude * 100 for %
) / {[.]CurrAvg}) * 100

```

---

<div class="post-metadata">

**Author:** ![Tyler\_Dixon](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@Tyler\_Dixon](https://forum.inductiveautomation.com/u/Tyler_Dixon)\
**Post date:** [December 15, 2025, 9:00pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823/8 "2025-12-15T21:00:17Z")

</div>

Ugh, those darn close parenthesis!!!

---

<div class="post-metadata">

**Author:** ![Tyler\_Dixon](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@Tyler\_Dixon](https://forum.inductiveautomation.com/u/Tyler_Dixon)\
**Post date:** [December 15, 2025, 9:01pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823/9 "2025-12-15T21:01:32Z")

</div>

Here is what worked. Thanks @ryan.white & @pturmel !!!!!

```python
// Current Unbalance Formula
(
// Calculate Absolute Maximum Deviation of Phase Currents
(max(abs({[.]CurrA} - {[.]CurrAvg}), 
abs({[.]CurrB} - {[.]CurrAvg}), 
abs({[.]CurrC} - {[.]CurrAvg}))
) 
// Divide by Current Average Magnitude * 100 for %
/
{[.]CurrAvg}
)*100

```

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 17, 2025, 5:33pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823/10 "2025-12-17T17:33:20Z")

</div>

You have excess parenthesis, two pairs of which can be eliminated.

```python
// Current Unbalance Formula
// Calculate Absolute Maximum Deviation of Phase Currents
max(
    abs({[.]CurrA} - {[.]CurrAvg}), 
    abs({[.]CurrB} - {[.]CurrAvg}), 
    abs({[.]CurrC} - {[.]CurrAvg})
) / {[.]CurrAvg} * 100

```

I recommend indenting consistently so that the closing bracket lines up vertically with the function that opens the parenthesis (if both aren't on the same line). Add spaces both sides of mathematical operators. They're separate words and legibility is improved.  
Make it easy for the next guy!

---

<div class="post-metadata">

**Author:** ![Tyler\_Dixon](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@Tyler\_Dixon](https://forum.inductiveautomation.com/u/Tyler_Dixon)\
**Post date:** [December 17, 2025, 8:47pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823/11 "2025-12-17T20:47:07Z")

</div>

@Transistor,  
I don't recall how Ignition handles math, but the \* 100 needs to occur last in the calculation. This is why I had multiple parenthesis. You edits do look more clean though.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 17, 2025, 10:44pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-using-opc-tag-path-error/112823/12 "2025-12-17T22:44:44Z")

</div>

> [@Tyler\_Dixon](#):
>
> ,,, the \* 100 needs to occur last in the calculation.

No, multiplication and division are commutative.

> # commutative
> 
> /kəˈmjuːtətɪv,ˈkɒmjʊtətɪv/

> _adjective_  
> **Mathematics**  
> involving the condition that a group of quantities connected by operators gives the same result whatever the order of the quantities involved, e.g. **a** × **b** = **b** × **a**.

You can try it out in the expression editor.

The only caution I can think of is when restricted to integer maths better accuracy can usually be obtained by multiplying _first_ and then dividing. This sequence avoids multiplication of the rounding errors.
