Script for getting data from dataset to memory tag

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

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!

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.

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

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

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

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

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

1 Like

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!

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

image

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

1 Like