# Get details of a binding from within a script?

**URL:** <https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620>\
**Category:** Ignition\
**Tags:** ignition81, perspective, scripting\
**Created:** [December 2, 2023, 4:37pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620 "2023-12-02T16:37:54Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [December 2, 2023, 4:37pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/1 "2023-12-02T16:37:54Z")

</div>

If I am inside a script in a Perspective view object, is there anyway to get the details of a tag that is bound to a parameter on that object?

What I think I want is the equivalent of [system.tag.getConfiguration](https://docs.inductiveautomation.com/display/DOC81/system.tag.getConfiguration) that works on a bound parameter rather than a string path to a tag, but I can't seem to recognize what that function would be within the [System Functions](https://docs.inductiveautomation.com/display/DOC81/System+Functions).

---

<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:** [December 2, 2023, 4:46pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/2 "2023-12-02T16:46:52Z")

</div>

No such thing. If you need such at runtime, use an indirect tag binding, and just look at the property feeding the indirection.

(It is possible in Vision with SDK apis, but nothing like that is accessible for Perspective.)

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [December 2, 2023, 4:53pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/3 "2023-12-02T16:53:39Z")

</div>

> [@pturmel](#):
>
> and just look at the property feeding the indirection

I'm guessing you mean use an indirect binding with no indirection parameters, but I can't quite see the relevance. So pretend that I'm really dumb today, what does that mean in terms of being in a Perspective script?

---

<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:** [December 2, 2023, 5:01pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/4 "2023-12-02T17:01:01Z")

</div>

> [@peter](#):
>
> If I am inside a script in a Perspective view object, ...

**Object** or **component**?

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [December 2, 2023, 5:20pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/5 "2023-12-02T17:20:31Z")

</div>

> [@Transistor](#):
>
> > [@peter](#):
> >
> > If I am inside a script in a Perspective view object, ...
> 
> **Object** or **component**?

I'm not sure of the correct terminology here, but the architecture is:

1. I have a View (View #1) with a parameter exposed on it (EG Param A)
2. View #1 has a script running in it.
3. I have an embed view whose path points to View #1
4. In the embedded view I surface Param A in the embedded view's parameters

At this point I can bind a tag to the surfaced Param A. In my script all the way back on View #1, I want to get same the details of the tag that I would have got using the tag path and system.tag.getConfiguration.

I know that I am likely doing Bad Things™, but I would like to get these details because I am trying to make View #1 into a robust library object, so I want to gather information in case the person making the binding has .. shall we say .. not chosen the correct means of configuration.

My current solution is that instead of binding a tag to Param A, I instead copy the path of the tag, and paste that in as a static value of Param A and then insert the value of Param A into a call to getConfiguration(). Which, while it works, is Ugly™ and I want to see if I can eliminate that ugliness.

---

<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:** [December 2, 2023, 5:29pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/6 "2023-12-02T17:29:50Z")

</div>

OK, to summarise, I think your setup is as follows:

```auto
- View
    - Embedded view component
        - path : View#1
        - param : ParamA

```

where ParamA is working as a tag path in text format but you would like it to accept a tag binding instead but still be able to access all the tag's properties.

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [December 2, 2023, 5:31pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/7 "2023-12-02T17:31:09Z")

</div>

> [@Transistor](#):
>
> where ParamA is working as a tag path in text format but you would like it to accept a tag binding instead but still be able to access all the tag's properties.

Yes, that is correct. From within a script running on View#1

But was hoping not to have to explain everything in order to avoid confusion. However, I apparently failed at that .. lol

---

<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:** [December 2, 2023, 5:40pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/8 "2023-12-02T17:40:08Z")

</div>

Ok. Still no. You cannot introspect a tag binding in Perspective to get the tag path. You are stuck with Ugly™.

Furthermore, View #1 has no knowledge/access to the view in which it is embedded. For its parameters, it just gets parameter _ **values** _. There's no difference within View#1 whether the parent view is supplying a constant, or values and updates from bindings, or value updates from scripts.

Perspective does not have any concept of traversing view encapsulation boundaries, like you can with Vision Windows and Templates. So even **if** Perspective offered a way to interrogate a tag binding, only the parent view could do so.

---

<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:** [December 2, 2023, 5:53pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/9 "2023-12-02T17:53:10Z")

</div>

Keep it simple.

Name the View#1 parameter clearly so that it's obvious that it only accepts a string path. e.g.,  
`tagPathString : [default]MyFolder/MyTag`

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [December 2, 2023, 6:00pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/10 "2023-12-02T18:00:50Z")

</div>

I already do that, and I am pointing it out in documentation. But part of the problem is that I have multiple parameters, and only one of them requires this treatment, and I hate inconsistency.

The other part is that there is a lot of emphasis on bindings in Perspective, so it's going to be easy to slip up and bind something to ParamA instead of paste in the path value.

However, I just realized that if someone _does_ bind to ParamA, then the call to getConfiguration() is likely going to fail, so I will have some advanced warning that things aren't going well. I just need to figure out how best to indicate that to the user (I'm thinking of something like the Quality overlay system)

---

<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:** [December 2, 2023, 6:04pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/11 "2023-12-02T18:04:42Z")

</div>

> [@peter](#):
>
> then the call to getConfiguration() is likely going to fail

Well, they might bind an expression that yields a dynamic tag path. Which your embedded view should handle just fine, as long as it is smart enough to accept changing tag paths at runtime.

But keep in mind that if they don't supply a tag path, then the entire usage within the embedded view will fail. Any indirect bindings using the bogus tagpath will fail, and give you your overlay.

---

<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:** [December 2, 2023, 6:08pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/12 "2023-12-02T18:08:33Z")

</div>

FWIW, I think your use of getConfiguration is unwise. You should simply indirect bind the tagpath with the `.PropertyName` suffix to obtain the current value of interest to your nested view. No concern with supplying default values. And no heavyweight scripting. (Don't use scripts where you don't need them.)

If you have a large set of properties of interest, perhaps with multiple tags within a folder tagpath, you might find my `tags()` function helpful (from my Integration Toolkit).

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [December 2, 2023, 6:17pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/13 "2023-12-02T18:17:47Z")

</div>

> [@pturmel](#):
>
> FWIW, I think your use of getConfiguration is unwise. You should simply indirect bind the tagpath with the `.PropertyName` suffix to obtain the current value of interest to your nested view. No concern with supplying default values. And no heavyweight scripting. (Don't use scripts where you don't need them.)

Remember I mentioned doing Bad Things™? I am deliberately abusing system.opc.writeValue(), which requires knowing that the tag I am pointing to is an OPC tag, and getConfiguration() provides me with all the information I need for that function. If the tag is not an OPC tag (EG Memory) then I am abusing another set of functions: system.tag.write...()

But the abuse is needed (and I have tested the abusive and non-abusive versions of what I want to do). However, note that this _ **not** _ for a production system, but instead a hardware simulation test system where I can accept abusing Ignition in order to achieve what I need.

---

<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:** [December 2, 2023, 6:26pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/14 "2023-12-02T18:26:05Z")

</div>

> [@peter](#):
>
> nowing that the tag I am pointing to is an OPC tag

Yeah, and the specific properties needed can be indirect bound instead. My point still stands.

> [@peter](#):
>
> _ **not** _ for a production system

No excuse. Arguably a hardware simulation system is simply a _ **production tool** _ for QA of your _ **other** _ development systems, so I dispute your label for it, whether relevant or not.

> [@peter](#):
>
> to achieve what I need

Well, in this case, you will have to suck it up and use the Ugly™ way, because Perspective strictly encapsulates its views.

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [December 2, 2023, 10:08pm UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/15 "2023-12-02T22:08:39Z")

</div>

> [@pturmel](#):
>
> No excuse. Arguably a hardware simulation system is simply a _ **production tool** _ for QA of your _ **other** _ development systems, so I dispute your label for it, whether relevant or not.

You could argue that, but then you'd need to explain to me how I can fit about 15 or 20 full sized cabinets in my 10 x 12 home office, along with a full selection of remote I/O connected via various Ethernet and Profinet cables, and an 11kV supply.

At some point in testing I have to make trade-offs when you are testing software for a 80m high crane, because there is no QA other than the fully constructed and wired up device.

---

<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:** [December 3, 2023, 1:38am UTC](https://forum.inductiveautomation.com/t/get-details-of-a-binding-from-within-a-script/82620/16 "2023-12-03T01:38:06Z")

</div>

> [@peter](#):
>
> explain to me how I can fit about 15 or 20 full sized cabinets in my 10 x 12 home office

Where'd you get that strawman? I didn't say you shouldn't be emulating/simulating your hardware. I was saying that your emulation/simulation is **itself** a production system for your development pointed at it.
