Combined Reference

I want to be able to change my reference according to a number in a table. So e.g.
op(‘constant’ + str(op(‘table1’) [0,0]).par.value0=99

The Table values in [0,0] will change, so that I will refernce to constant1, constant 2, …
But somehow it doesnt worl. I tried to find something about the right syntax, but cannot find annything for my exemple.
I also tried inserting a variable but this didnt work either.
n=1
op(‘constant’ + var(‘n’)).par.value0=99
Dies anybidy know what is wrong in the syntax, or does it simply not work this way?

hello, the right syntax (tested) is:
op(‘constant’ + str(op(‘table1’)[0,0])).par.value0 = 99
you missed the last parenthesis

Thanks Jaques, I tried so long. That works. And how would it work with the variable?

I do not completely understand what you want. If you declare a variable:
n = 1
you should write:
op(‘constant’ + str(n)).par.value0=99
you dont need to quote a variable and var() declare the variable and is not necessary in Python
I recommend you to use a text editor as Sublime Text with Python package, you will avoid parenthesis error.
Jacques

Thank you jaques for the tip with sublime text. Installed it. It will help me not to make the mistakte with the parenthesis. Now I tried it with the variable and it works if define n with a number, in my case value 1. But if I set n to a value from a constant e.g. op(‘set’)[‘chan1’] it doesnt work. I attached variable.tox (558 Bytes) my exemple file.

… sorry, I uploaded the wrong file. here is the update onevariable.tox (558 Bytes)