Templates and scripting

I have a template that contains a multi-state indicator, this template has a custom property called “machine”, I have a project with 2 windows, in the first window I have my template and the custom property “machine” is “1” and in the second window of my project I have the same template but the custom property “machine” is “2”.

Can you tell me how to script this or give example - so that the multi-state indicators state in the first window is controlled by “tag 1” and the multi-state indicators state in the second window is controlled by “tag 2”

Thank you much.
Chris

You are 75% there. All you need to do is bind the “State” property of the multi-state indicator in the template to an “Indirect Tag Binding.” Basically, you can make the path to your tag dynamic using the template property you have called machine. In order to make this work your tags have to organized in such a way that lends itself well to indirection.

Here is an example, let’s say you have the following tag paths:

Folder/TagPath1
Folder/TagPath2

the only difference between the two tag paths is just the 1 or 2. That can easily be replaced with the machine property. When you bind the state property to an indirect tag path, first enter in a tag path to start out with:

Folder/TagPath1

then remove the 1 and click on the link to the right hand side to select the machine property from the template. It will make the path look like this:

Folder/TagPath{1}

where {1} equals “TemplateName.machine”. That’s it. When the machine is a value of 1 it will point to tag 1 and when it is 2 it will point to tag 2.

Perfect thank you. one other problem - when I drag the template into the windows the mult-state indicator has no color, I can now get the state to change and the text for each state changes but not the color. any ideas?

thanks again.
Chris

I also noticed when I copy and paste a multi-state indicator that the pasted indicator has no background color. Ive tried playing with the style customizer but cant seem to get the background color to show up.

OK I figured out whats going on. on the multistate indicator in the style customizer for the first state I made the background color red but I made it partially translucent. Ive found if the color is solid the multistate indicator will copy and paste just fine but if the color is translucent at all the pasted indicator is messed up… possible bug?