# Indirect Addressing through an Expression or an OPC tag

**URL:** <https://forum.inductiveautomation.com/t/indirect-addressing-through-an-expression-or-an-opc-tag/8479>\
**Category:** Ignition\
**Created:** [May 21, 2014, 4:23pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-through-an-expression-or-an-opc-tag/8479 "2014-05-21T16:23:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![oxanemi](https://avatars.discourse-cdn.com/v4/letter/o/0ea827/32.png) [@oxanemi](https://forum.inductiveautomation.com/u/oxanemi)\
**Post date:** [May 21, 2014, 4:23pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-through-an-expression-or-an-opc-tag/8479/1 "2014-05-21T16:23:13Z")

</div>

I want to address a tag within a tag using both an expression and by creating a new OPC Tag.  
I have a tag with the following path:

```auto
 CMP2VC/EditRecipe/Step/Step_1_/TimeEnable 
```

I want to make the value of 1 in the above path dynamic. I have another tag that it should be referring to for obtaining that value. For example,

```auto
 CMP2VC/EditRecipe/Step/Step_[EditRecipeStepIndex]_/TimeEnable 
```

The EditRecipeStepIndex outputs an integer value and I want the tag to refer to that value.

I have tried it using two ways. One is through an expression and the other one through an OPC tag.  
Neither worked!

Expression:

```auto
 tag({CMP2VC/EditRecipe/Step/Step_}+"toInt({CMP2VC/EditRecipe/EditRecipeStepIndex})"+"_TimeEnable") 
```

New OPC Tag:  
In OPC Item Path

```auto
[CMP2VC]Global.EditRecipe.Step.Step[Global.EditRecipeStepIndex].TimeEnable 
```

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [May 21, 2014, 4:31pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-through-an-expression-or-an-opc-tag/8479/2 "2014-05-21T16:31:11Z")

</div>

Try:

Expression:

```auto
tag("CMP2VC/EditRecipe/Step/Step_"+toStr({CMP2VC/EditRecipe/EditRecipeStepIndex})+"_/TimeEnable")
```

---

<div class="post-metadata">

**Author:** ![oxanemi](https://avatars.discourse-cdn.com/v4/letter/o/0ea827/32.png) [@oxanemi](https://forum.inductiveautomation.com/u/oxanemi)\
**Post date:** [May 21, 2014, 4:40pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-through-an-expression-or-an-opc-tag/8479/3 "2014-05-21T16:40:34Z")

</div>

[quote=“adamaustin”]Try:

Expression:

`
tag("CMP2VC/EditRecipe/Step/Step_"+toStr({CMP2VC/EditRecipe/EditRecipeStepIndex})+"_/TimeEnable")
`[/quote]

Works! Thanks!

I implemented it using Indirect Tag Binding but I wanted to find a way where I didn’t need to refer it to a custom property!

Is it possible to do this sort of thing by creating a new OPC tag and dynamically binding its tag path?

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [May 21, 2014, 4:46pm UTC](https://forum.inductiveautomation.com/t/indirect-addressing-through-an-expression-or-an-opc-tag/8479/4 "2014-05-21T16:46:50Z")

</div>

That’s what [User Defined Types or User Defined Data Types](https://docs.inductiveautomation.com/pages/viewpage.action?pageId=1704431) (UDTs or UDDTs) are for.
