Transform and continuity of errors

Hello!

I currently have a tag that gives a string (5%, 18%...) or nothing.

I'm writting it in a text field. The thing is,that I want it to show the string or "--"

So I tried this:

And it works!

However, it is possible to lose connection, so we need to show the label of "bad quality" that ignitions have. The problem is that the expression or script transformation doesn't continue the errors.

image

How could I do this?

Thanks in advance!

I am guessing in designer your view.params.path is blank and so the tag path is not valid right now giving your that error. If you hover over the error with the mouse it should give you a bit more information.

2 Likes

Just like isNull, you can use isBad, isBadOrError, isGood... To implement any logic you want based on value's quality

6 Likes

Also consider swapping to coalesce to wrap your null condition statement more concisely and avoid repeating the value input.

3 Likes

@pascal.fragnoud @PGriffith the thing is that I want the error to continue, not get lost. Something like I did here with the map transform:

The error continues but the value also gets updated correctly.

In the example I shown before, whenever the value gets returned the error simply is lost.

The same example as the first one but using a map transform (notice how the error gets shown in the text field on the right)

However, doing it like this is not viable.

Use this to build a qualified value based on the quality of the value received.

edit:
Actually, forceQuality would be simpler.
to make it clear, it will look something like this:

forceQuality(coalesce({value}, '--'), qualityOf({value}))
1 Like

image
:confused: ?

the value is ""

Whatever, I'm just gonna do it another way using map transform. Is not worth it the extra work...

1 Like

If coalesce doesn't return the default value, then the initial value provided isn't null.
Check your values. If you're getting "" instead of "--", I'm willing to bet your input is not null but an empty string. Those are not the same thing.

Using a script transform for this IS extra work. The expression I provided above is exactly what you're asking for in the simplest possible form.

See how in your screenshot the Tag preview doesn't show null ?

2 Likes