No viable alternative to .... after [default]path/to/tag

Hello I am quite new to ignition.
I need to update two memory tags only when the user clicks on a button so I am trying to build a list of parameters in order to call system.tag.writeblocking(Varl_list, Value_list, timeout)

here is my code:
# Create a list with the tag paths to be updated.
paths = [“[default]Produzione/ActDiametro”,“[default]Produzione/ActSpessore”]

# Create a list with the update values, one value for each path.
values = [{[default]configurazioni/SelectedCode[0,1]},{[default]configurazioni/SelectedCode[0,2]}]
 
# Execute the write operation.
system.tag.writeBlocking(paths, values,500)

I get the error:

org.python.core.PySyntaxError
File “function:runAction”, line 9
values = [{[default]configurazioni/SelectedCode[0,1]},{[default]configurazioni/SelectedCode[0,2]}]
^
SyntaxError: no viable alternative at input ‘configurazioni’

How can I fill in the values list with the value taken from other tags ?

Thank you.

You have to read the tags using system.tag.readBlocking(). This function will return a list of qualified values, 1 for each supplied tag path. The order of the QV’s in the list will match the order of the tag paths.

Something like:

readPaths = ["[default]Produzione/ActDiametro","[default]Produzione/ActSpessore"]
readValues = [qValue.value for qValue in system.tag.readBlocking(readPaths)]

writePaths = ["[default]configurazione/SelectedCode","[default]configurazioni/SelectedCode"]

system.tag.writeBlocking(writePaths,readValues)

Obviously, I don’t know your tag structure so this may well not work for what you’re actually trying to do, just trying to illustrate what is needed.

From your syntax, it appears as though you are mixing the expression language and scripting. They are not the same.

1 Like

Noted, now it works.

Thank you