# Cell binding using indirect tag / change dataset by scripting

**URL:** <https://forum.inductiveautomation.com/t/cell-binding-using-indirect-tag-change-dataset-by-scripting/20115>\
**Category:** Ignition\
**Created:** [October 12, 2018, 6:33am UTC](https://forum.inductiveautomation.com/t/cell-binding-using-indirect-tag-change-dataset-by-scripting/20115 "2018-10-12T06:33:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ASF](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@ASF](https://forum.inductiveautomation.com/u/ASF)\
**Post date:** [October 12, 2018, 6:33am UTC](https://forum.inductiveautomation.com/t/cell-binding-using-indirect-tag-change-dataset-by-scripting/20115/1 "2018-10-12T06:33:30Z")

</div>

Hi all,

I have an easy chart object, and I would like the axis to automatically update according to an indirect tag.

When I call the window, I pass a tag path in as a custom parameter. This tag path points me to a UDT instance which has:

Value  
Value\_Min  
Value\_Max

I can use cell binding to add the “Value” tag to the Tag Pens:

```auto
[~]{Root Container.TagPath}/Value
```

But I can’t find a way to do this to bind the Value\_Min and ValueMax to the axis upper bound and lower bound. Is there a way?

Alternatively, I can try to script it. I understand that you can’t alter a dataset with scripting, but that you can use system.dataset.setValue to return a new dataset which is identical to the original except with your changes made. So, once I have this dataset, how do I make the Easy Chart look at my new DataSet for its Axes? I tried

`AxesDataset = [path to trend].axes
MinScale = system.tag.read([path to tag]).value
MaxScale = system.tag.read([path to tag]).value
system.dataset.SetValue(AxesDataset,[row],'lower_bound', MinScale)
system.dataset.SetValue(AxesDataset,[row],'upper_bound', MaxScale)
[path to trend].axes = AxesDataset
`

But so far no luck

---

<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:** [October 12, 2018, 12:14pm UTC](https://forum.inductiveautomation.com/t/cell-binding-using-indirect-tag-change-dataset-by-scripting/20115/2 "2018-10-12T12:14:13Z")

</div>

[system.dataset.setValue()](https://docs.inductiveautomation.com/display/DOC79/system.dataset.setValue) returns a new dataset each time, as the original is immutable. You have to assign the return value to your AxesDataset variable each time. Also, note that case matters in the function name.

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [October 12, 2018, 12:32pm UTC](https://forum.inductiveautomation.com/t/cell-binding-using-indirect-tag-change-dataset-by-scripting/20115/3 "2018-10-12T12:32:24Z")

</div>

If you can use cell binding to bind the `Value` tag to the Tag Pens dataset TAG\_PATH property, what’s stopping you binding the `Value_Max` and `Value_Min` tags to the Axes dataset UPPER\_BOUND and LOWER\_BOUND properties? Make sure you also set the Axes dataset AUTO\_RANGE property to false.

---

<div class="post-metadata">

**Author:** ![ASF](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@ASF](https://forum.inductiveautomation.com/u/ASF)\
**Post date:** [October 14, 2018, 10:36pm UTC](https://forum.inductiveautomation.com/t/cell-binding-using-indirect-tag-change-dataset-by-scripting/20115/4 "2018-10-14T22:36:54Z")

</div>

pturmel - assigning the return value to the AxesDataset is what I can’t work out. How do I do that? I’m sure it’s simple, it’s just my first foray into Ignition and I’m on the learning curve.

AlThePal - I’d guess why it’s not working in this case is because the tag path is expecting a tag, so when I pass it a string which resolves to a valid tag path, it interprets it as such. Whereas the upper and lower bounds are expecting an integer, so when I pass it a string, it doesn’t know what to do with it. Similar problem if I try to set units with cell binding - I have a string tag where I store the units to display on one of the axes. The tag is an indirect tag since I’m passing a tag path to the display initially. So I can bind the units cell to {Root Container.TagPath}/Units, and it resolves to Analogs/TT1234/Units - but then that’s exactly what’s displayed on the graphics. “Analogs/TT1234/Units”, not “°C”, which is the value of the tag.

I guess all of this would be solved if I could find a way to have it interpret my input as the value of the tag path I pass to it, instead of literally just the tag path as a string, but I haven’t found a way to do that yet. Any ideas?

---

<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:** [October 15, 2018, 1:21am UTC](https://forum.inductiveautomation.com/t/cell-binding-using-indirect-tag-change-dataset-by-scripting/20115/5 "2018-10-15T01:21:03Z")

</div>

> [@ASF](#):
>
> pturmel - assigning the return value to the AxesDataset is what I can't work out. How do I do that?

This is more of a python question than an Ignition question.... but something like this:

```auto
AxesDataset = [path to trend].axes
MinScale = system.tag.read([path to tag]).value
MaxScale = system.tag.read([path to tag]).value
AxesDataset = system.dataset.SetValue(AxesDataset,[row],'lower_bound', MinScale)
AxesDataset = system.dataset.SetValue(AxesDataset,[row],'upper_bound', MaxScale)
[path to trend].axes = AxesDataset

```

> [@ASF](#):
>
> I guess all of this would be solved if I could find a way to have it interpret my input as the value of the tag path I pass to it, instead of literally just the tag path as a string, but I haven't found a way to do that yet. Any ideas?

The best way to do this is to use a custom property as an intermediate value, _of the correct datatype_, with an indirect tag binding. That's exactly what indirect tag bindings exist for. The indirect binding takes your string as a tag path (or combines it to produce a tag path), and delivers that tag's value. Then use that custom property in your cell binding.

Consider taking a couple weeks to go through Inductive University. That'll greatly cut down on not knowing what is possible with Ignition.

---

<div class="post-metadata">

**Author:** ![ASF](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@ASF](https://forum.inductiveautomation.com/u/ASF)\
**Post date:** [October 15, 2018, 1:49am UTC](https://forum.inductiveautomation.com/t/cell-binding-using-indirect-tag-change-dataset-by-scripting/20115/6 "2018-10-15T01:49:19Z")

</div>

Thanks, I’ll have a play with both options.

I have gone through most of IU. It’s a lot of information to take in, I figure I’m remembering about 50%, able to find another 40% by going back through the videos to jog my memory, and the folks here are being extremely helpful with the remaining 10% 🙂

On most SCADA packages I’d be thrilled to have it be as simple as adding a custom property - but when going through the IU videos I was repeatedly struck by how many workarounds I didn’t need any more because Ignition has a feature built in. So every so often I just get caught up wondering if there’s a neater or “more correct” way to achieve my aim. That’s where I ended up here. I ended up solving the problem of cell-update-binding the units to the easy chart by using a custom property as an intermediate value, as you suggest. When I got to the upper and lower bounds, I just started to wonder if there was a smarter way of doing it than just adding more and more custom properties. But, if that’s the way it’s generally done, then great!

I’ll have a play with the scripting regardless, for my own knowledge, and see if I can get it to work. But the more I think about it, the more I think that custom properties is overall a much simpler and easier to follow solution.

Thanks for your tips!

---

<div class="post-metadata">

**Author:** ![Claus\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Claus\_Nielsen](https://forum.inductiveautomation.com/u/Claus_Nielsen)\
**Post date:** [October 15, 2018, 8:52am UTC](https://forum.inductiveautomation.com/t/cell-binding-using-indirect-tag-change-dataset-by-scripting/20115/7 "2018-10-15T08:52:12Z")

</div>

The simplest way I can think of is create two custom properties somewhere and bind the min and max tag values to these using indirect tags. Then in the cell bindings you can use the two custom properties created.
