Hi Connection,
I have made the template repeater. and wrote script at property change as to show the tags value from the array Int data type. It's been executing according to the tag Value, but the Template repeater is loading all the time unable to see the stable screen. it is loading all the time.
I think you misunderstand what a property change script does.
It triggers when a property on the component changes. ANY property, by the way, so you should ALWAYS filter on the property's name:
if event.propertyName == "some_property":
# do things
Anyway, that's probably not what you actually want.
I'd suggest something, but I'm really not sure what it is exactly you're trying to do.
Can you explain what's in your template, and when they should update ?
But if I had to guess the proper way of doing this:
rework your template to take a tag path, then use this path in tag bindings IN THE TEMPLATE.
Then just pass those paths to your repeater instances.
@Transistor:
I agree that he should remove the spaces, but it's syntactically correct. Python doesn't care.
Hi @Transistor & @pascal.fragnoud , Thanks for connecting me.,
I have changed the script.still it's the same. I have 5 tags value in the array format.so.will able to repeat the template according to size of the array, nearly 1 to 20 array bit it.so in my case I am Able to read all values, of tag but the Template is loading,
And I have given the Print function over there its continuously repeating in the Loop at console when its Launched.
Tag Bindings According to template its possible but my tag value is in array format, so we are unable bind. though we are coming up with the Script format.
Pascal's advice is correct. Use indirect binding with tag paths in your templates. Do not update the templates dataset in the repeater as tag values change. That reloads the templates, as you've noticed. Don't do that.
@pascal.fragnoud I Have 4 tags with the array format, so I need to replace the all-array bit in the component of Template repeater so Binding the tag is not possible so will go with the Scripting.
Just to replace all the 4-array tag. Bit in the Template repeter.
Just because you don't know how to do it doesn't mean it's not possible...
Again, if you give us more details, we can help you find a better solution.
But from what I understand, you have 4 array tags. Those are fixed so you don't even need to pass the paths to your templates, all you need is the instance number, which would correspond to the index of the value in the arrays. Then you use an expression like this: {tagpath}[instance_num]
Does vision have a built-in instance number property like the flex repeater ? If so, you don't even need to parameterize it.
Typically, when I load a template repeater from an initialization script, I will do it from the propertyChange event handler like you did above, only I will specify the componentRunning event to ensure the script will only run once:
if event.propertyName == 'componentRunning':
#ActualInt = system.tag.readBlocking...
The only thing that has to be remembered for testing purposes when using componentRunning is that the event won't occur in the designer unless preview mode is already running before the window with the component is opened.
The only one I would consider using for component initialization would be internalFrameOpened, but not for a component specific script. I feel that keeping a script like this with the component it affects is more intuitive and maintainable for future me and those who follow me.
internalFrameActivated would reinitialize the component every time the window lost and subsequently regained focus, and I've heard of unexpected behaviors occuring with visionWindowOpened that I imagine are the result of the event firing before the internal components have been painted.
These suffer from similar issues that the component running property does in the designer.
I believe that the internalFrameActivated will fire if you have multiple windows open and switch between them, but otherwise you have to close and reopen the window.