Tag path concatenation

system.tag.write(’[Client]input/’ + section + ‘_value’, value)

whereas ‘section’ is a string variable.

Fails with:

TypeError: cannot concatenate ‘str’ and ‘com.inductiveautomation.ignition.common.sqltags.BasicTagValue’ objects

as this is being used in a a parameterized window, this would save me a complex switch style case selection and maintaining a hard coded reference to sections in this window.

I assumed this would work because the quoted string appears to be, well, a string… :unamused:

I solved this, it was created by me.

I had assumed that the return of a tag.read operation on a string tag would be the string value.

The BasicTagValue was however an object that contained the quality and the value.
I had assumed the error message was telling me that the BasicTagValue was what I was trying to combine with my string path variable, instead it was telling me that the string tag path could not be combined with my retrieved value.

So when I cast my tag return to string I was actually left with the string ‘[,]’

using tag.read().value retrieved the string only portion, and then the concatenated path worked as expected…

All fixed now, just a learning experience.

1 Like

[quote=“Sir Hacksalot”]
I had assumed that the return of a tag.read operation on a string tag would be the string value.

The BasicTagValue was however an object that contained the quality and the value.[/quote]

This mistake is so common that it should be some kind of initiation into the Ignition user brotherhood :wink:

Glad you figured it out.