# Basic Integer Expression Tag producing Error\_ExpressionEval error

**URL:** <https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [March 26, 2025, 5:22pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264 "2025-03-26T17:22:42Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Collinson](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Robert\_Collinson](https://forum.inductiveautomation.com/u/Robert_Collinson)\
**Post date:** [March 26, 2025, 5:22pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/1 "2025-03-26T17:22:42Z")

</div>

Hi All,

Wondered if anyone could offer us some advice regarding an issue we're seeing with multiple expression tags.

It appears that SOME (not all) of our expression tags result in an Error\_EspressionEval error.

They're all based on a UDT and are quite simple 'If' logic in the main.

One of our tags named P\_Target\_Count is itself is returning an Integer with the following expression:

```python
if (isNull({[.]P_Target_Count}), 0,
if({[.]Timers/P_Timer} = {[.]Set_Line_Speed}, {[.]P_Target_Count}+1, {[.]P_Target_Count}))

```

P\_Timer is an Integer producing Expression tag  
Set\_Line\_Speed is a Float which has been set to a constant value of 300.0 via the UDT

Thing is, it will continue to update the tag's value regardless of whether the Error\_ExpressionEval has been triggered or not.

It seems to be fine for most of the tags using this UDT, however, occasionally, it seems as if some of the tags go into this error state.

To clear it, we simply cut, apply, and then paste back in, the expression within the tag and it clears the error....for a while.

Thing is, the exact same code has been utilised and is running in the 7.9 instance this project has been upgraded from without such errors occurring.

We also see the same error occurring in a similar fashion with the P\_Timer tag along with a number of other tags throughout the same UDT tag group, as mentioned, for a number of tags utilising it.

We're stumped as where it's been working without issue, it continues to do so...without issue.

Is there some quirk about how we should be interacting with the tags which differs between 7.9 and 8.1.[latest version] that we're not aware of?

Many thanks for any pointers anyone may have.

Kind Regards  
Rob

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 26, 2025, 5:32pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/2 "2025-03-26T17:32:34Z")

</div>

> [@Robert\_Collinson](#):
>
> One of our tags named P\_Target\_Count is itself is returning an Integer with the following expression:

Are you recursively referencing the P\_Target\_Count tag?

---

<div class="post-metadata">

**Author:** ![Robert\_Collinson](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Robert\_Collinson](https://forum.inductiveautomation.com/u/Robert_Collinson)\
**Post date:** [March 26, 2025, 5:46pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/3 "2025-03-26T17:46:35Z")

</div>

Thanks for the reply, only, apologies, not sure what you mean...can you expand on this?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 26, 2025, 5:49pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/4 "2025-03-26T17:49:10Z")

</div>

Sure,

You say that P\_Target\_Count is returning an Integer with the expression. That expression is referencing the Tag `{[.]P_Target_Count}`.

---

<div class="post-metadata">

**Author:** ![Robert\_Collinson](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Robert\_Collinson](https://forum.inductiveautomation.com/u/Robert_Collinson)\
**Post date:** [March 26, 2025, 5:51pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/5 "2025-03-26T17:51:29Z")

</div>

Ah, sorry, yes, it is 'self referential'...is that a bad thing to do?

This is code we've been passed to support, and, as mentioned, seems to work fine when used in Ignition 7.9...it seems however no longer to be the case within the 8.1 test system we've been asked to migrate it over to though

---

<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:** [March 26, 2025, 5:52pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/6 "2025-03-26T17:52:08Z")

</div>

In other words, expression tags are not really designed to handle `X = X + 1` or anything like it. If it worked in v7.9, it was by accident.

---

<div class="post-metadata">

**Author:** ![Robert\_Collinson](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Robert\_Collinson](https://forum.inductiveautomation.com/u/Robert_Collinson)\
**Post date:** [March 26, 2025, 5:53pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/7 "2025-03-26T17:53:32Z")

</div>

Magic!

I mean, even in 8.1, it works for a while 😃

how could we get around this issue then...is the answer going to be...scripts, many, many scripts?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 26, 2025, 5:55pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/8 "2025-03-26T17:55:22Z")

</div>

> [@Robert\_Collinson](#):
>
> Ah, sorry, yes, it is 'self referential'...is that a bad thing to do?

Yeah, definitely not a great practice. One I'm surprised works at all.

> [@Robert\_Collinson](#):
>
> how could we get around this issue then...

Is this really something that needs to be Gateway Global? I wouldn't say many scripts. What is the actual goal you're trying to achieve?

---

<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:** [March 26, 2025, 5:56pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/9 "2025-03-26T17:56:01Z")

</div>

Looks like you are trying to integrate over time? Use timestamps and value change events to control the action, a "prior accumulation" for rate changes, and an expression tag to yield current value from time.

---

<div class="post-metadata">

**Author:** ![Robert\_Collinson](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Robert\_Collinson](https://forum.inductiveautomation.com/u/Robert_Collinson)\
**Post date:** [March 26, 2025, 5:59pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/10 "2025-03-26T17:59:38Z")

</div>

have to be honest, it uses the words 'time' only, it seems to be a 'counter' based on the the tag update rate...ticking up +1 for every cycle through the tags.

Not entirely sure it's time based...i mean, you're right, it could be as we'd just need to look at the cycle time and work backwards from there.

hmm, something to dive into tomorrow now methinks

Thanks for your feedback, along with anything anyone else may have

---

<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:** [March 26, 2025, 6:15pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/11 "2025-03-26T18:15:11Z")

</div>

> [@Robert\_Collinson](#):
>
> based on the the tag update rate

That means it is integrating over time. Change the update rate (which isn't very precise anyways) and you change the result. Using timestamps as the basis for the calculation makes it independent of the tag update rate.

---

<div class="post-metadata">

**Author:** ![Robert\_Collinson](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Robert\_Collinson](https://forum.inductiveautomation.com/u/Robert_Collinson)\
**Post date:** [March 26, 2025, 6:29pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/12 "2025-03-26T18:29:57Z")

</div>

Problem is, coming at it from a 'support' perspective, who's to say that that wasn't what was required in the first place?

Under the ITIL standard, unless we have the original design specification available, we'd basically be second guessing the original intent at this point by implementing a 'change' in design.

:-/

Probably quite safe to say it is though.

---

<div class="post-metadata">

**Author:** ![Robert\_Collinson](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Robert\_Collinson](https://forum.inductiveautomation.com/u/Robert_Collinson)\
**Post date:** [March 27, 2025, 5:25pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/13 "2025-03-27T17:25:06Z")

</div>

Just a quick clarification...using the 'recursive referencing is bad' perspective, am I to also assume it would be bad to use an expression to understand whether the tag you are creating the expression for currently has a 'null' value and then use the expression to set itself to zero upon finding it is?

Also, if i'm using an if statement to work out what to do if true or false, and upon returning a result false I wanted the value of the tag to remain as per the value it currently has, then, how would I do this without 'self referencing' the tag i'm creating the expression against?

Could just pump in the keyword 'pass' or something like that?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 27, 2025, 5:44pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/14 "2025-03-27T17:44:49Z")

</div>

> [@Robert\_Collinson](#):
>
> use an expression to understand whether the tag you are creating the expression for currently has a 'null' value and then use the expression to set itself to zero upon finding it is?

Yes.

The result of the expression **is** the value of the tag, in "theory" it wont be null unless you make it null.

I'm not even quite sure how to imagine this scenario, how would an expression which results in a 'Null' value ever not result in a 'Null' value?

---

<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:** [March 27, 2025, 5:44pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/15 "2025-03-27T17:44:54Z")

</div>

> [@Robert\_Collinson](#):
>
> how would I do this without 'self referencing' the tag i'm creating the expression against?

You cannot. Don't use an expression for this.

---

<div class="post-metadata">

**Author:** ![Robert\_Collinson](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Robert\_Collinson](https://forum.inductiveautomation.com/u/Robert_Collinson)\
**Post date:** [March 27, 2025, 5:50pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/16 "2025-03-27T17:50:03Z")

</div>

Basically, I was asking if I wanted to understand whether the current value of 'my tag' is null, and, if it is, I wanted to set 'my tag' to '0', and, I was using an expression configured against 'my tag' to do this, then, doing so would also be bad?

---

<div class="post-metadata">

**Author:** ![Robert\_Collinson](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Robert\_Collinson](https://forum.inductiveautomation.com/u/Robert_Collinson)\
**Post date:** [March 27, 2025, 5:52pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/17 "2025-03-27T17:52:04Z")

</div>

so in that case, I would be using an if within the expression and would have no action to perform upon a false being detected.

If that was the case, what is the expression method for simply continuing without doing anything?

---

<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:** [March 27, 2025, 5:55pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/18 "2025-03-27T17:55:07Z")

</div>

> [@Robert\_Collinson](#):
>
> continuing without doing anything?

There is none. You **must** return a value, and it **cannot** reference itself.

Don't use an expression like this. Use scripting on a timer to perform counting/integration.

---

<div class="post-metadata">

**Author:** ![Robert\_Collinson](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Robert\_Collinson](https://forum.inductiveautomation.com/u/Robert_Collinson)\
**Post date:** [March 27, 2025, 6:00pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/19 "2025-03-27T18:00:34Z")

</div>

Thanks, for your response.

Think there may now need to be a conversation with someone about this historical code.

---

<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:** [April 11, 2025, 5:10pm UTC](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264/20 "2025-04-11T17:10:09Z")

</div>

Split this topic on April 11, 2025, 5:10pm UTC

6 posts were split to a new topic: [Locating Broken Bindings](https://forum.inductiveautomation.com/t/locating-broken-bindings/105008)

[Next page](https://forum.inductiveautomation.com/t/basic-integer-expression-tag-producing-error-expressioneval-error/104264.md?page=2)
