Script to lookup a dataset tag and bring corresponding column values?

Hello I want to create a memory dataset tag which includes all desired info and want to have a script that looks for the value and brings corresponding desired column result for that value. I tried this;


Dataset2 is a memory dataset tag

This is resulting an error like this;

Error executing script.
Traceback (most recent call last):
File “tagevent:valueChanged”, line 2, in valueChanged
NameError: global name ‘lookup’ is not defined

Could anyone help me with a code to achieve this.


You’re mixing the expression language and jython.

To read the value of a tag you need to use system.tag.readBlocking().

That will return a list of qualified values, so you will also want to pull the value from that. Since your tag is a dataset tag, you will get the whole dataset returned. Code will look something like

ds = system.tag.readBlocking(["[.]Dataset2"])[0].value
OPname = ds.getValueAt(1,'Hata')

I am trying to use ignitions expression function lookup.It is I think the most convinient way of doing what I want. This is basically like an excel vlookup which is exactly what I want. I see this on the ignition manuel here;

Even though I try to use the same code in the link I keep getting lookup is not defined error do I need to import a library first? how to define it?

Please help here


You can’t use expression functions in jython scripts. Use an expression binding or an expression tag to use any expression function.

1 Like

Thanks have not realized the expression bindings before really helpfull, got it to work what I need