# No image state loading when signal quality != 'Good'

**URL:** <https://forum.inductiveautomation.com/t/no-image-state-loading-when-signal-quality-good/83402>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 20, 2023, 10:31pm UTC](https://forum.inductiveautomation.com/t/no-image-state-loading-when-signal-quality-good/83402 "2023-12-20T22:31:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [December 20, 2023, 10:31pm UTC](https://forum.inductiveautomation.com/t/no-image-state-loading-when-signal-quality-good/83402/1 "2023-12-20T22:31:46Z")

</div>

i do not want to look at an empty image error placeholder when the incoming signal quality is not 'Good'. so i built the following binding on a custom prop `isOn`. the idea being if the signal stinks, i can look at a nice image telling me that. when it comes back online, i can then view the relevant switch states. problem is, this isn't working. i'm still seeing things that make me cry:

![Screenshot 2023-12-20 151651](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/6/f6f702d647a18a4756fee7429a0acdc9a71ffe7e.png)

here's the code i bound to the image source (bear in mind `isOn` is a custom prop bound to a Tag's boolean flag):

```python
def transform(self, value, quality, timestamp): #<-- from isOn prop
	if quality != 'Good':
		return '/system/images/development/btn_noSIG.svg'
	elif value:
		return '/system/images/development/btn_ON.svg'
	else:
		return '/system/images/development/btn_OFF.svg'

```

the Binding Preview evaluates successfully AND correctly. but my eyes are still accosted when i load the page. what am i missing here?

---

<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 20, 2023, 10:40pm UTC](https://forum.inductiveautomation.com/t/no-image-state-loading-when-signal-quality-good/83402/2 "2023-12-20T22:40:40Z")

</div>

Quality is a rich object, not a simple string. Maybe `quality.isGood()` as your conditional. Or `isNotGood()`.

---

<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 20, 2023, 10:51pm UTC](https://forum.inductiveautomation.com/t/no-image-state-loading-when-signal-quality-good/83402/3 "2023-12-20T22:51:55Z")

</div>

If you can do it with an expression binding then do. It's faster. Does this work for you?

```auto
if(isGood({[default]MyTag}),
	if({[default]MyTag},
		'/system/images/development/btn_ON.svg',
		'/system/images/development/btn_OFF.svg'
	),
	'/system/images/development/btn_noSIG.svg'
)

```

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [December 21, 2023, 2:08pm UTC](https://forum.inductiveautomation.com/t/no-image-state-loading-when-signal-quality-good/83402/4 "2023-12-21T14:08:40Z")

</div>

> [@Transistor](#):
>
> an expression binding

haven't used these much. but you had me at " **faster**". 😃

i'll give that a whirl now.

EDIT: works like a charm. and i learned a lot of new stuff. thank you! 👍

---

<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:** [December 21, 2023, 2:27pm UTC](https://forum.inductiveautomation.com/t/no-image-state-loading-when-signal-quality-good/83402/5 "2023-12-21T14:27:35Z")

</div>

Always go for an expression over a script when possible.

---

<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 21, 2023, 2:59pm UTC](https://forum.inductiveautomation.com/t/no-image-state-loading-when-signal-quality-good/83402/6 "2023-12-21T14:59:23Z")

</div>

> [@ian.sebryk](#):
>
> but you had me at " **faster**"

This was the primary motivation for this summer's Integration Toolkit expansion:

> [@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…

If you care about speed, read the whole thing.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [December 21, 2023, 4:38pm UTC](https://forum.inductiveautomation.com/t/no-image-state-loading-when-signal-quality-good/83402/7 "2023-12-21T16:38:00Z")

</div>

> [@pturmel](#):
>
> If you care about speed

there's only TWO places i don't care about speed: Government Policy Making by Idiots and just about anything where i'm naked. so i have some Christmas reading ahead of me. 📚

---

<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 21, 2023, 5:02pm UTC](https://forum.inductiveautomation.com/t/no-image-state-loading-when-signal-quality-good/83402/8 "2023-12-21T17:02:25Z")

</div>

> [@ian.sebryk](#):
>
> some Christmas reading

This forum estimates the time commitment:

> There are **87** replies with an estimated read time of **35 minutes**.

May not need to wait for Christmas. (:

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [December 22, 2023, 10:24pm UTC](https://forum.inductiveautomation.com/t/no-image-state-loading-when-signal-quality-good/83402/9 "2023-12-22T22:24:25Z")

</div>

sorry. had to modify the solution, because it doesn't work _as constituted_. so i just modified it so it reflects both the driving _state_ (from the Tag) that determines if it shows the NO-SIG, and the subsequent _flag_ needed to populate ON//OFF.

```python
if(isGood({[IansTCG4Tags]Assets/LeDevice/Node/Tags/dOutput1}),
	if({this.props.isOn},
		'/system/images/development/btn_ON.svg',
		'/system/images/development/btn_OFF.svg'
	),
	'/system/images/development/btn_noSIG.svg'
)

```

ALL credit goes to @Transistor because the original post is his, i just modified it to behave correctly. plus i also got to learn about expressions in a way i never knew before. all around making me a better wunderkind. 😉

it still fails when it goes offline, dammit, but i don't know what to do about that right now. the NO-SIG image _should_ load, but it doesn't... and i don't know what to chase down. in theory, we're done here, i guess.

HAVE A MERRY CHRISTMAS YOU FABULOUS REPROBATES!! 🥳

God bless and keep you. I'll be back in the New Year.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [January 2, 2024, 5:56pm UTC](https://forum.inductiveautomation.com/t/no-image-state-loading-when-signal-quality-good/83402/10 "2024-01-02T17:56:34Z")

</div>

just a quick edit. this solution feel somewhat flakey in that the browser/HMI needs refreshing a couple times before it displays properly. so i'm thinking it's a cache thing, which is out of scope here. but for those that follow: clear your caches!

EDIT: this also applies when the device goes offline. it reverts to the eyesore red box until you refresh the browser/HMI. very odd.

---

<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:** [January 2, 2024, 6:51pm UTC](https://forum.inductiveautomation.com/t/no-image-state-loading-when-signal-quality-good/83402/11 "2024-01-02T18:51:47Z")

</div>

I would expect `isGood` to work on a tag even if the source is offline. It still works on one of my CNC tags even when the machine is off.

Maybe try this instead

```auto
try(
	if({this.props.isOn} && isGood({[IansTCG4Tags]Assets/LeDevice/Node/Tags/dOutput1}),
		'/system/images/development/btn_ON.svg',
		'/system/images/development/btn_OFF.svg'
	),
	'/system/images/development/btn_noSIG.svg'
)

```
