UDT - Writing from dataset in UDT to other tags in UDT

I am trying to use a dataset that is populated by a query to populate other tags. This is all in a UDT, but I don't seem to be able to get the tags to write within the UDT.
The image below is the dataset I am trying to pull tags from.

Below is the sample code I have been trying:

Like always, I truly appreciate the help you all offer!

Code I have tried:
if currentValue.value >= 1:
#AccessLevel = system.tag.readBlocking("[.]UserLookUp[0,1]")[0]
#AccessLevel = AccessLevel.value
#system.tag.writeBlocking("[.]AccessLevel", AccessLevel)[0]
ds = system.tag.readBlocking(['[.]UserLookup'])[0].value
print ("Code has ended")

Thank you,


What's that doing there?

Also, system.tag.writeBlocking - Ignition User Manual 8.1 - Ignition Documentation is expecting a list of tagpaths and a list of values to write to those paths so that line should look like,
system.tag.writeBlocking(["[.]AccessLevel"], [AccessLevel])
It "tolerates" the misuse but that could break in a future upgrade.

Tip: while the picture of code can be useful for context, always post the (formatted) code so we don't have to type it all out to test it or use it in our answers.

In addition to what @Transistor pointed out, I also am pretty sure that you can't use that notation to read a value from a dataset. You would need to read the value and process the dataset just as normal.

if currentValue.value:
    ds = system.tag.readBlocking(['[.]UserLookup'])[0].value

However, I believe you would be better off making the tags expression tags and using the lookup() expression. lookup - Ignition User Manual 8.1 - Ignition Documentation

As a note, I'm not sure that writeBlocking does tolerate a string tag path and value in place of the a list. I know readBlocking does as that is now formally documented. I haven't actually tested it to see.

1 Like

I have attempted this code, and it doesn't appear to work. Is there a way to pull in the tag path for each of these tags? I know if I use the full tag path, the code will work but when utilizing a UDT I run into issues such as this.

Appreciate the help.

The expression or the script? What indicates that it doesn't work? Don't get the expected result or an error?

Not that should be done in a tag value change script.

Can you provide the code that you tried, as well as the structure of the UDT. Perhaps your relative path is incorrect.

I apologize, the code did work. The PLC was overwriting it faster than ignition would update. Updates to PLC I had missed.

I would recommend that you only write to a tag from one direction. Will stop races like that from being able to happen.