# Expression, weird return

**URL:** <https://forum.inductiveautomation.com/t/expression-weird-return/94112>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [August 2, 2024, 12:39pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112 "2024-08-02T12:39:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 2, 2024, 12:39pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/1 "2024-08-02T12:39:48Z")

</div>

How is this expression returning 2??

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/2/22d712ff6242512c4baf7b6bd6eed4e38fd3843c.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 2, 2024, 12:41pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/2 "2024-08-02T12:41:19Z")

</div>

Do you have a tag named 'test'?

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 2, 2024, 12:42pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/3 "2024-08-02T12:42:02Z")

</div>

i have a style class named test

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [August 2, 2024, 12:52pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/4 "2024-08-02T12:52:53Z")

</div>

You're not doing this in the right place. Move that expression to the `expression` tab (the third one in the menu on the left)

A tag binding is meant to get data from a tag, and a `tag expression` binding uses an expression to build the path of that tag. In your particular case, you're trying to read a tag named "test"

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 2, 2024, 1:35pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/5 "2024-08-02T13:35:06Z")

</div>

Ah i get it!

This actually comes from another issue i was having. I have this expression tag:

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/2/b243162f12d0548e4e4ed43168fd61b6591a94e1.png)  
the expression is this:  
if({[.]../../SA\_HTR\_OV/UDT/18/PumpBlock\_Pct\_Out} \< 1.00 && {[.]../Heater Monitoring/SA\_18\_PB\_1\_amps} \<= '0.2', true, false)

As you can see its returning False.  
Those tag values are as follows:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/4/c46c8891a8af6d0b90bba9ff6f96e259178524a9.png)  
and  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/1/310b35446711287e81340101bfc5e2a15508338d.png)  
Shouldnt this be returning True?

---

<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:** [August 2, 2024, 1:37pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/6 "2024-08-02T13:37:11Z")

</div>

> [@mjohnson0238](#):
>
> \<= '0.2'

You are comparing to a string, not a number. Why are there quotes?

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 2, 2024, 1:43pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/7 "2024-08-02T13:43:13Z")

</div>

That me trying both ways, I get the same result even if its just numbers, just poo and giggles, lol.

if({[.]../../SA\_HTR\_OV/UDT/18/PumpBlock\_Pct\_Out} \< 1.00 && {[.]../Heater Monitoring/SA\_18\_PB\_1\_amps} \<= 0.2, true, false)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/f/0f925ea940490439131ae95d3df366885bee1e4f.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:** [August 2, 2024, 1:47pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/8 "2024-08-02T13:47:29Z")

</div>

First, get rid of the `if(...., true, false)`. Wherever you do that, just put the `....`. You're adding visual noise that prevents seeing possible problems.

Then, split the remaining expression at the `&&` and test the two parts separately.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 2, 2024, 1:57pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/9 "2024-08-02T13:57:16Z")

</div>

OK, so when I do just this I get an error, just says error:  
{[.]../../SA\_HTR\_OV/UDT/18/PumpBlock\_Pct\_Out} \< 1.00  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/c/ac1a04f5d64e700447ffe2f9e7cd901e80dfa449.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/d/1d0bbb7ddff63b093c26dc69665d8f592f102ef4.png)

the other part gives me the same results:  
{[.]../Heater Monitoring/SA\_18\_PB\_1\_amps} \<= 0.2  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/4/0427013a807f644ca8c8ec77ea2a708ef7aba5e6.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/4/c4d19ff8b3ea215d411f64003316cb45b4931e6f.png)

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [August 2, 2024, 2:08pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/10 "2024-08-02T14:08:42Z")

</div>

Now look to see what the `Error_ExpressionEval` is.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 2, 2024, 2:10pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/11 "2024-08-02T14:10:41Z")

</div>

when i hover over the error it just displays Error\_ExpressionEval

---

<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:** [August 2, 2024, 2:20pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/12 "2024-08-02T14:20:25Z")

</div>

Please 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:** ![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:** [August 2, 2024, 2:24pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/13 "2024-08-02T14:24:10Z")

</div>

> [@mjohnson0238](#):
>
> just displays Error\_ExpressionEval

Run the tag's diagnostics to get more detail.

Perhaps you should use the tag picker in the expression editor to verify that tag path.

You could also use my Integration Toolkit's [debugMe()](https://www.automation-pros.com/toolkit/doc/debugging.html#debugme) function to log the evaluation errors in detail. (Be aware that recent versions of Ignition have a bug that prevents newly installed modules' expression functions from working in expression tags until the gateway itself is restarted.)

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 2, 2024, 2:29pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/14 "2024-08-02T14:29:19Z")

</div>

I am using 8.1.32. I dont have the option for diags when i right click the 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:** [August 2, 2024, 2:30pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/15 "2024-08-02T14:30:05Z")

</div>

Open the tag editor. Click the diagnostics button in the upper right. This isn't available in a right-click menu.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 2, 2024, 2:34pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/16 "2024-08-02T14:34:25Z")

</div>

OK I see, thanks.

Here is what i am seeing, looks like a null value was returned:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/b/eb377efd9e4bf32448b92ede713ad90db63102c2.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:** [August 2, 2024, 2:37pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/17 "2024-08-02T14:37:57Z")

</div>

See the dots with the text icon next to it? Click that. Paste the result here and **use the preformatted text button**.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 2, 2024, 2:43pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/18 "2024-08-02T14:43:30Z")

</div>

Looks like when i used the tag() finction this works correctly:

```python
tag("[default]Phase 1 Extrusion/SA18/Heater Monitoring/SA_18_PB_1_amps") <= 0.2 && tag("[default]Phase 1 Extrusion/SA_HTR_OV/UDT/18/PumpBlock_Pct_Out") < 1.0

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/7/476e3420377ac45f983df57eb1b94f219d8b0ec3.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:** [August 2, 2024, 2:44pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/19 "2024-08-02T14:44:48Z")

</div>

> [@mjohnson0238](#):
>
> this works correctly:

Right, but that isn't an apples-to-apples comparison. One is using relative paths and the other is using absolute paths.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 2, 2024, 2:54pm UTC](https://forum.inductiveautomation.com/t/expression-weird-return/94112/20 "2024-08-02T14:54:40Z")

</div>

When I change it back to relative paths the result is good.  
`{[.]../../../SA_HTR_OV/UDT/18/PumpBlock_Pct_Out} <1.0 && {[.]../../Heater Monitoring/SA_18_PB_1_amps} <= 0.2`  
`Last published value	[true, Good, Fri Aug 02 09:51:19 CDT 2024 (1722610279205)]	INFO`

??

[Next page](https://forum.inductiveautomation.com/t/expression-weird-return/94112.md?page=2)
