# Indirect Addressing in Expression Error

**URL:** <https://forum.inductiveautomation.com/t/indirect-addressing-in-expression-error/4190>\
**Category:** Ignition\
**Created:** [March 22, 2012, 12:44pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-in-expression-error/4190 "2012-03-22T12:44:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlr573](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@jlr573](https://forum.inductiveautomation.com/u/jlr573)\
**Post date:** [March 22, 2012, 12:44pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-in-expression-error/4190/1 "2012-03-22T12:44:26Z")

</div>

I get an error when I change my expression from direct addressing to indirect.  
This expression works:

`toInt({PDM Line 1/Product Run/Caculations/runTime}) + ":" +
if({PDM Line 1/Product Run/Caculations/runTime}%60<10,
	"0","")+
{PDM Line 1/Product Run/Caculations/runTime}%60 + " Calculated Runtime"`

But when I change it to this:

`toInt(tag({Root Container.lineName} + "/Product Run/Caculations/runTime")/60) + ":" +
if(tag({Root Container.lineName} + "/Product Run/Caculations/runTime")%60<10,
	"0","")+
tag({Root Container.lineName} + "/Product Run/Caculations/runTime")%60 + " Calculated Runtime"`

I get this error  
"Type mismatch in operation ‘DIVIDE’. expected ‘Number’ , found ‘Object’

---

<div class="post-metadata">

**Author:** ![markdobtech](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@markdobtech](https://forum.inductiveautomation.com/u/markdobtech)\
**Post date:** [March 22, 2012, 2:30pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-in-expression-error/4190/2 "2012-03-22T14:30:35Z")

</div>

I didn’t correct the entire expression- however the first line parens syntax is off:

toInt(tag({Root Container.lineName} + “/Product Run/Caculations/runTime”)/60) + “:” +

should be

toInt(tag({Root Container.lineName} + “/Product Run/Caculations/runTime”)) /60 + “:” +

need to get the object to a value, then do the math

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [March 22, 2012, 3:25pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-in-expression-error/4190/3 "2012-03-22T15:25:43Z")

</div>

Right, here is the correct expression:`(toInt(tag({Root Container.lineName} + "/Product Run/Caculations/runTime"))/60) + ":" +
if((toInt(tag({Root Container.lineName} + "/Product Run/Caculations/runTime"))%60)<10,
   "0","")+
(toInt(tag({Root Container.lineName} + "/Product Run/Caculations/runTime"))%60) + " Calculated Runtime"`

---

<div class="post-metadata">

**Author:** ![jlr573](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@jlr573](https://forum.inductiveautomation.com/u/jlr573)\
**Post date:** [March 23, 2012, 1:58pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-in-expression-error/4190/4 "2012-03-23T13:58:03Z")

</div>

Thanks for the help. I’m getting a similar error on this code as well

```auto
if(tag({Root Container.lineName} + "/Product Run/Caculations/caseHourActualDiff") <= 0, 90, -90)
```

What I don’t understand about this error is this expression will work with this code:

```auto
if({PDM Line 1/Product Run/Caculations/caseHourActualDiff} <= 0, 90, -90)
```

But when I make it dynamic I get the error.

Type mismatch in operation ‘Less Than or Equal’ expected ‘Number’, found ‘Object’

How does making this dynamic change it into an object?  
The tag “caseHourActualDiff” is of type INT.

---

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [March 23, 2012, 2:59pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-in-expression-error/4190/5 "2012-03-23T14:59:56Z")

</div>

[quote=“jlr573”]Thanks for the help. I’m getting a similar error on this code as well

```auto
if(tag({Root Container.lineName} + "/Product Run/Caculations/caseHourActualDiff")[color=#FF0000])[/color] <= 0, 90, -90)
```

[/quote]

You were still missing a closing parenthesis.

---

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [March 23, 2012, 3:00pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-in-expression-error/4190/6 "2012-03-23T15:00:18Z")

</div>

weird. double post.

---

<div class="post-metadata">

**Author:** ![jlr573](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@jlr573](https://forum.inductiveautomation.com/u/jlr573)\
**Post date:** [March 23, 2012, 3:06pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-in-expression-error/4190/7 "2012-03-23T15:06:14Z")

</div>

That doesn’t work either because The second closing parenthesis end the “if(” statement. Causing the argument to fail.

---

<div class="post-metadata">

**Author:** ![markdobtech](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@markdobtech](https://forum.inductiveautomation.com/u/markdobtech)\
**Post date:** [March 23, 2012, 3:46pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-in-expression-error/4190/8 "2012-03-23T15:46:09Z")

</div>

You need to coerce the object into a value.

Try this;  
if(toInt(tag({Root Container.lineName} + “/Product Run/Caculations/caseHourActualDiff”)) \<= 0, 90, -90)

---

<div class="post-metadata">

**Author:** ![jlr573](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@jlr573](https://forum.inductiveautomation.com/u/jlr573)\
**Post date:** [March 23, 2012, 4:25pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-in-expression-error/4190/9 "2012-03-23T16:25:57Z")

</div>

Thanks markdobtech  
That was the ticket!
