# Pipe Fill Color per Expression Binding of Tag value

**URL:** <https://forum.inductiveautomation.com/t/pipe-fill-color-per-expression-binding-of-tag-value/83043>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 12, 2023, 5:19pm UTC](https://forum.inductiveautomation.com/t/pipe-fill-color-per-expression-binding-of-tag-value/83043 "2023-12-12T17:19:59Z")\
**Posts on this page:** 6\
**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 12, 2023, 5:19pm UTC](https://forum.inductiveautomation.com/t/pipe-fill-color-per-expression-binding-of-tag-value/83043/1 "2023-12-12T17:19:59Z")

</div>

Trying to change pipe color based off a tag value, my experimental tag is a voltage tag averaging around 480. The Pipe fill color looks to be changing in the Perspective property editor correctly when I set some experssion logic, when checking true condition, if(tag\>0,toColor("red")), and then checking false if(tac\>490,toColor("black")), see code and images. However, the pipe view is not changing within my coordinate container. Please advise. I do have a broken icon next to the fill property stating "The value of this property will not be saved with the view".

if({[Sample\_Tags]_ESIF-A207-RS910_/UnitId 4/4\_Vab0-4\_Vab0/4\_Vab0}\>0,toColor("red"),toColor("black"))

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/7/27735fe67599c49511b018619de48a41434d27f5.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/6/268439032b003cfeb4bd90e80f7132a6a43f5498.png)

if({[Sample\_Tags]_ESIF-A207-RS910_/UnitId 4/4\_Vab0-4\_Vab0/4\_Vab0}\>490,toColor("red"),toColor("black"))

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/4/d4b8dcb46bf5695200a05a527849cc152b44db8d.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/d/bdce0113a338d1c7be3561f57e74b78527fec8e7.png)

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [December 12, 2023, 5:54pm UTC](https://forum.inductiveautomation.com/t/pipe-fill-color-per-expression-binding-of-tag-value/83043/2 "2023-12-12T17:54:49Z")

</div>

- think you must \*use `tag() function` to read value of a tag path

[https://docs.inductiveautomation.com/display/DOC81/tag](https://docs.inductiveautomation.com/display/DOC81/tag)

---

<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 12, 2023, 6:05pm UTC](https://forum.inductiveautomation.com/t/pipe-fill-color-per-expression-binding-of-tag-value/83043/3 "2023-12-12T18:05:36Z")

</div>

> [@sebastien\_ng](#):
>
> use `tag() function`

Eww! No! Not in user interfaces.

Instead, add a custom property to hold your live tag value, using an _indirect tag binding_. In your original expression, use that property.

(There are pathological behaviors associated with the `tag()` function. Use it only in actual expression tags.)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 12, 2023, 6:07pm UTC](https://forum.inductiveautomation.com/t/pipe-fill-color-per-expression-binding-of-tag-value/83043/4 "2023-12-12T18:07:07Z")

</div>

Unfortunately, the color values you get out of the expression language don't adapt to the web environment - they're somewhat "legacy" holdovers from Vision, which uses a Java specific color model.

Try returning a literal string `"red"` or `"black"`, as a test (as in, drop `toColor` entirely) - or a hex color string like `"#FF0000"`.

---

<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 12, 2023, 6:10pm UTC](https://forum.inductiveautomation.com/t/pipe-fill-color-per-expression-binding-of-tag-value/83043/5 "2023-12-12T18:10:06Z")

</div>

> [@Tyler\_Dixon](#):
>
> if({[Sample\_Tags]_ESIF-A207-RS910_/UnitId 4/4\_Vab0-4\_Vab0/4\_Vab0}\>0,toColor("red"),toColor("black"))

Reformatting:

```auto
if(
    {[Sample_Tags]ESIF-A207-RS910/UnitId 4/4_Vab0-4_Vab0/4_Vab0} > 0,
    "red",
    "black"
)

```

Be kind to yourself and those who have to maintain your code!  
Also see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).

---

<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 12, 2023, 7:08pm UTC](https://forum.inductiveautomation.com/t/pipe-fill-color-per-expression-binding-of-tag-value/83043/6 "2023-12-12T19:08:19Z")

</div>

@paul-griffith & @Transistor looks like removing the Vision java code worked, "red", "black" for true/false. The pipe within the containter is now changing. Thank you, I knew it was something simple.

@sebastien_ng & @pturmel - Functions. I am definately looking into using funcitons, but I still need more experience to deploy them in my project. Right now, our system is so newbie that I just need simple graphics and navigation to deploy a draft and use case to get more funding for equipment at locations on our facility that we need visibility. I will reach out with any Function questions at a later date. Thank you for responding with suggestions, they are noted!!
