How to read component values from tag value change scripts in perspective?

Hello ,

I have many views in perspective project which includes texts, labels numeric entry field and other components which have expression on it. I need to read some of these component values in a tag script. What is the correct syntax?

Thanks

Tags and clients are completely separate scopes. you can’t read client component values from tag scripts, but you can write to tags from component scripts or bindings.

What are you trying to achieve?

Ok so not possible to read the value of component inside tag script. There are some values on components such as labels and entry fields that are generated with expressions, I have a script that records these to sql. I wanted to read everything inside this script.

What I think I do now is to create memory tags and bidirectionally bind it to components. I just did not want to create tags for them because there are so many.

So what I understand is component values can only be read on event scripts?

Thnk you nminchin

Yes, any client component or view script can read your component values.

This is most likely how I would do it. You can auto create your tags if you have enough of them to warrant it, either using system.tag.comfigure in combination with system.tag.getConfiguration, or alternatively generate the json outside of igntion and paste in.

Using memory tags to record values form a session to a database is dangerous as there could be many sessions open and changing those values at any given time. Why does the Tag change need to drive this logic? Couldn’t you have a single component bound to the tag and then place the update logic into a change script on the component?

1 Like

I actually read it as the sql insert statements would run on the client on a button or something, while the tags were just there to store the values for something else. There isn’t much context provided