# Script for getting data from dataset to memory tag

**URL:** <https://forum.inductiveautomation.com/t/script-for-getting-data-from-dataset-to-memory-tag/60564>\
**Category:** Ignition\
**Tags:** scripting, perspective\
**Created:** [June 9, 2022, 5:02pm UTC](https://forum.inductiveautomation.com/t/script-for-getting-data-from-dataset-to-memory-tag/60564 "2022-06-09T17:02:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [June 9, 2022, 5:02pm UTC](https://forum.inductiveautomation.com/t/script-for-getting-data-from-dataset-to-memory-tag/60564/1 "2022-06-09T17:02:52Z")

</div>

Hello!

I am trying to write a script that takes a selected row from my table, and write it to a memory tag. I would also like to have the only first column for this tag. I am using a button with the OnActionPerformed event to do this as well. I am still learning Ignition so forgive my ignorance, this is the code I have so far :  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/d/0d252749c0b06b4fe1eff6b97168cb2e2fe6daed.png)

I get a “code could not be compiled error” which leads me to believe that I am missing some information within my code. Any help would be greatly appreciated!

Thank you!

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [June 9, 2022, 5:07pm UTC](https://forum.inductiveautomation.com/t/script-for-getting-data-from-dataset-to-memory-tag/60564/2 "2022-06-09T17:07:25Z")

</div>

Your script needs to be indented to match the documentation lines. Notice that you are writing a script to go _inside_ the `runAction` function. With no indentation, it isn’t inside the function.

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [June 9, 2022, 5:21pm UTC](https://forum.inductiveautomation.com/t/script-for-getting-data-from-dataset-to-memory-tag/60564/3 "2022-06-09T17:21:52Z")

</div>

Ah that fixed the could not be compiled error! Although, now it is giving me this error:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/5/85a221c317a37b0adc235f58ba17d4e8d737a285.png)

It says it is pointing to line 2, “object has no attribute source”. is this because it cannot find the table I am using?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 9, 2022, 5:22pm UTC](https://forum.inductiveautomation.com/t/script-for-getting-data-from-dataset-to-memory-tag/60564/4 "2022-06-09T17:22:56Z")

</div>

`event.source` is what you’d use in a Vision event handler.

In `runAction`, you have `self` to point to the current object.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [June 9, 2022, 5:23pm UTC](https://forum.inductiveautomation.com/t/script-for-getting-data-from-dataset-to-memory-tag/60564/5 "2022-06-09T17:23:18Z")

</div>

change that event.source to self…Ah Paul beat me to it 🙂

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [June 9, 2022, 5:28pm UTC](https://forum.inductiveautomation.com/t/script-for-getting-data-from-dataset-to-memory-tag/60564/6 "2022-06-09T17:28:33Z")

</div>

Ah I didn’t know that! I changed it to self but now it is erroring ` object has no attribute 'getComponent` thank you for all your help!

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [June 9, 2022, 5:41pm UTC](https://forum.inductiveautomation.com/t/script-for-getting-data-from-dataset-to-memory-tag/60564/7 "2022-06-09T17:41:57Z")

</div>

It looks like you’re in perspective, so you need to use the browse properties button to see the actual path you need.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/8/48774ed6cd23f55106c724631ce8ef26ff5d39ac.png)

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [June 9, 2022, 6:08pm UTC](https://forum.inductiveautomation.com/t/script-for-getting-data-from-dataset-to-memory-tag/60564/8 "2022-06-09T18:08:14Z")

</div>

That was it! I had the path wrong!  
Thank you for all your help!
