# Trying to get datapoint from dataset binding on custom property

**URL:** <https://forum.inductiveautomation.com/t/trying-to-get-datapoint-from-dataset-binding-on-custom-property/100625>\
**Category:** Ignition\
**Tags:** scripting, vision\
**Created:** [January 8, 2025, 10:52pm UTC](https://forum.inductiveautomation.com/t/trying-to-get-datapoint-from-dataset-binding-on-custom-property/100625 "2025-01-08T22:52:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [January 8, 2025, 10:52pm UTC](https://forum.inductiveautomation.com/t/trying-to-get-datapoint-from-dataset-binding-on-custom-property/100625/1 "2025-01-08T22:52:48Z")

</div>

I have a custom prop with a query binding, returns 1 row and 70 columns. In a button event script, I would like to get a value at `[0,2]`, etc.

I attempted to follow advice on this thread: [https://forum.inductiveautomation.com/t/bind-text-property-of-vision-label-to-tag-dataset-value/51197](https://forum.inductiveautomation.com/t/bind-text-property-of-vision-label-to-tag-dataset-value/51197)

But can't seem to get it to work.

Here is the code:

```python
value = u'{$\.sp_data}[0,3]'
#value = u'{$\.sp_data}'
#system.tag.writeBlocking(['[default]Testing Tags/Demaris/PS01_Setpoint.value'], [value])
print value

```

Neither of the `value=` statements returned a value. The print result was simply the value string: `{$\.sp_data}[0,3]` or `{$\.sp_data}`.

What am I missing here?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [January 8, 2025, 11:03pm UTC](https://forum.inductiveautomation.com/t/trying-to-get-datapoint-from-dataset-binding-on-custom-property/100625/2 "2025-01-08T23:03:47Z")

</div>

You are confusing the [expression syntax](https://www.docs.inductiveautomation.com/docs/8.1/platform/expression-language-and-syntax#dataset-access) for accessing a value in a dataset with the [python syntax](https://www.docs.inductiveautomation.com/docs/8.1/platform/scripting/python-scripting/variables-datatypes-and-objects/datasets#accessing-data-in-a-dataset) for accessing data in a dataset.

For python you need to do `yourDataset.getValueAt(0,2)`, or if its a pyDataset, `yourDataset[0][2]`.

You'll also need to fetch the dataset data, right now `value` is just a string with a value of `{$\.sp_data}[0,3]`. The proper path to fetch the dataset would look something more like `myDataset = event.source.parent.sp_data`.

To work correctly then, your script would look something like

```python
myDataset = event.source.parent.sp_data
myValue = myDataset.getValueAt(0, 2)
system.tag.writeBlocking(['[default]Testing Tags/Demaris/PS01_Setpoint.value'],[myValue])

```

> **[Scripting in Vision | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/vision/scripting-in-vision)**
>
> A lot of the scripting that happens in Vision is either located on components and windows, or it manipulates component and window values. Many times, you can easily add the path to another component or property from your script. It is important to...

If you have the script editor open for the event, on the right side near the top you should see a tag icon and an icon that looks like a list above that. If you click that list icon, you can traverse the components in your view to be able to find and reference the component property with your dataset.

 ![scriptEditor](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/a/fa57ab5c8b5e6e1281bd2f7f48db06ade35107be.png)

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [January 8, 2025, 11:58pm UTC](https://forum.inductiveautomation.com/t/trying-to-get-datapoint-from-dataset-binding-on-custom-property/100625/3 "2025-01-08T23:58:14Z")

</div>

Right you are! Those subtle differences between expression and python... 🤦‍♂️

I started this script off using the `Set Tag Value` builder. That's what gave me the `value = u'{$\.sp_data}'`.

Thank you, Ryan!
