# Auto Engineering Unit

**URL:** <https://forum.inductiveautomation.com/t/auto-engineering-unit/113769>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [February 4, 2026, 8:25pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769 "2026-02-04T20:25:47Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jbrownen](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@Jbrownen](https://forum.inductiveautomation.com/u/Jbrownen)\
**Post date:** [February 4, 2026, 8:25pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769/1 "2026-02-04T20:25:47Z")

</div>

Hello,

I am trying to figure out a way to automatically determine my engineering unit based off the tag name that I enter in. For example, if my tag starts with a ‘T’ then I want my unit to be F\*, or if my tag starts with a ‘P’ then I want my unit to be ‘PSI’ etc. I’m using an expression tag with the data type set to String inside my UDT that has the following script/code, but I can’t seem to get it to work write. Any thoughts or best practices?

If({TagPrefix} like 'P%', 'PSI', 'Null')||  
If({TagPrefix} like 'F%', 'MCFD', 'Null') ||  
If({TagPrefix} like 'T%', 'F', 'Null') ||  
If({TagPrefix} like 'L%', '%', 'Null')||  
IF({TagPrefix} like 'D%', 'INH2O', 'Null')

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/e/def7685dbeada5eae50363843c56457968dc1094.png)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [February 4, 2026, 8:29pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769/2 "2026-02-04T20:29:41Z")

</div>

use a case

```python
case( left({TagPrefix},1),
    'P', 'PSI',
    'F', 'MCFD', 
    'T', 'F',
    'L', '%',
    'D', 'INH2O',
    null
)

```

---

<div class="post-metadata">

**Author:** ![Jbrownen](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@Jbrownen](https://forum.inductiveautomation.com/u/Jbrownen)\
**Post date:** [February 4, 2026, 8:30pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769/3 "2026-02-04T20:30:33Z")

</div>

> [@dkhayes117](#):
>
> ```python
> case(left({TagPrefix},1),
> 'P', 'PSI',
> 'F', 'MCFD', 
> 'T', 'F',
> 'L', '%',
> 'D', 'INH2O',
> null
> )
> 
> ```

That did the trick. Thank you for the quick reply!

---

<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:** [February 4, 2026, 8:36pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769/4 "2026-02-04T20:36:58Z")

</div>

Ewww! This may work, but it is a terrible idea. Tags have an `engUnit` property for a reason!

---

<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:** [February 4, 2026, 8:46pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769/5 "2026-02-04T20:46:35Z")

</div>

Add them here!

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/5/55261c5f099617df69c4306254f2115cc9daae30.png)

Use them like this. You can drill down to the EngUnit using the Browse Tags selector.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/6/76c5f45d6afcf53dca7309445e96336f147dd65e.png)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [February 4, 2026, 8:51pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769/6 "2026-02-04T20:51:23Z")

</div>

> [@pturmel](#):
>
> Ewww! This may work, but it is a terrible idea.

That gives me Bingo! 😂

I was so anxious to fix his expression, I skimmed over the actual application of it.

---

<div class="post-metadata">

**Author:** ![Nol](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Nol](https://forum.inductiveautomation.com/u/Nol)\
**Post date:** [February 4, 2026, 9:29pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769/7 "2026-02-04T21:29:18Z")

</div>

Mini rant but it annoys me to no end the fact that there is no way to make labels respect the formatting set in the tag and/or display the units without additional bindings. Like the data is already in the tag and it can correctly format it in the tag browser. Why isn't there a way to bind that. Having to throw 3 bindings for the pv, format, and units and then an expression to combine it all just seems like something that could be made more efficient.

I really wish we had a PV.value and a PV.valueFormatted option or something

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

As others have said for OP's question though, I'd ditch the case statement and just write your values into the EngUnits field and then use that. You can even run a script to set them all if you're concerned with trying to avoid manual effort

---

<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:** [February 4, 2026, 9:36pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769/8 "2026-02-04T21:36:21Z")

</div>

> [@Nol](#):
>
> ... there is no way to make labels respect the formatting set in the tag and/or display the units without additional bindings...

True, but you should be able to create a view taking a tag path as a parameter and have the view retrieve the value, formatString and EngUnit and render them all appropriately. Then you can quickly embed that view anywhere.

---

<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:** [February 4, 2026, 9:38pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769/9 "2026-02-04T21:38:50Z")

</div>

> [@Nol](#):
>
> You can even run a script to set them all if you're concerned with trying to avoid manual effort

You can just create a UDT param for EngUnit and then use this in all the tags’ eng unit props values needing these units

---

<div class="post-metadata">

**Author:** ![Nol](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Nol](https://forum.inductiveautomation.com/u/Nol)\
**Post date:** [February 4, 2026, 9:41pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769/10 "2026-02-04T21:41:43Z")

</div>

> [@Transistor](#):
>
> True, but you should be able to create a view taking a tag path as a parameter and have the view retrieve the value, formatString and EngUnit and render them all appropriately. Then you can quickly embed that view anywhere.

Absolutely true but then the reality of Ignition struggling with embedding objects too many layers deep often comes into play unfortunately.

---

<div class="post-metadata">

**Author:** ![Jbrownen](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@Jbrownen](https://forum.inductiveautomation.com/u/Jbrownen)\
**Post date:** [February 19, 2026, 7:54pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769/11 "2026-02-19T19:54:26Z")

</div>

Coming back to this topic. I got the auto naming part figured out and is working well, however. I am trying to combine these two tags into one label but I'm unsuccessful in my attempts. Any tips or blatant errors on my part?

I'm using an expression binding with the following code.

> {view.params.TagPath.PV} + {view.params.TagPath.Units}

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/3/5391594233c3702b97c1c74d412e3386ea12ca85.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:** [February 19, 2026, 8:01pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769/12 "2026-02-19T20:01:58Z")

</div>

You need to use [`stringFormat`](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/string/stringFormat), or possibly [`numberFormat`](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/string/numberFormat).

Additionally, based on the fact that one of your params is named `tagPath.pv`, it appears you are passing the tag value through to the embedded view. Don't do that, just pass the tag path, and then create indirect tag bindings on private view custom properties in the embedded view. Make one property per tag/udt item you need to bring in. Then bind your display items to those custom properties.

---

<div class="post-metadata">

**Author:** ![Jbrownen](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@Jbrownen](https://forum.inductiveautomation.com/u/Jbrownen)\
**Post date:** [February 19, 2026, 8:15pm UTC](https://forum.inductiveautomation.com/t/auto-engineering-unit/113769/13 "2026-02-19T20:15:04Z")

</div>

This did the trick. Thank you!
