# Perspective module - reading/writing to predefined tags outside of binding

**URL:** <https://forum.inductiveautomation.com/t/perspective-module-reading-writing-to-predefined-tags-outside-of-binding/56928>\
**Category:** Module Development\
**Created:** [March 7, 2022, 8:08pm UTC](https://forum.inductiveautomation.com/t/perspective-module-reading-writing-to-predefined-tags-outside-of-binding/56928 "2022-03-07T20:08:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cthomas](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@cthomas](https://forum.inductiveautomation.com/u/cthomas)\
**Post date:** [March 7, 2022, 8:08pm UTC](https://forum.inductiveautomation.com/t/perspective-module-reading-writing-to-predefined-tags-outside-of-binding/56928/1 "2022-03-07T20:08:11Z")

</div>

I have a handful of tags that are created automatically on every gateway in our system. Since the path for each tag is static between every gateway, I’d like to build a component that reads/writes to these tags without needing to go into the designer and bind each tag to the component’s property tree.

Is there a “best” way to go about it? My initial thought is to use a data endpoint to parse data from each of the tags into a JsonObject, then use a delegate to handle writes back to the tags. Is there a better way to replicate a hard coded tag binding?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 7, 2022, 9:37pm UTC](https://forum.inductiveautomation.com/t/perspective-module-reading-writing-to-predefined-tags-outside-of-binding/56928/2 "2022-03-07T21:37:52Z")

</div>

Do you want to expose the live values of these tags in your component’s property tree, or do you just want to have a display only component that automatically displays the values of these tags and is kept up to date?

---

<div class="post-metadata">

**Author:** ![cthomas](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@cthomas](https://forum.inductiveautomation.com/u/cthomas)\
**Post date:** [March 7, 2022, 9:48pm UTC](https://forum.inductiveautomation.com/t/perspective-module-reading-writing-to-predefined-tags-outside-of-binding/56928/3 "2022-03-07T21:48:29Z")

</div>

The latter! Although some of the tags (maybe 5%) will need some write capability.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 7, 2022, 10:15pm UTC](https://forum.inductiveautomation.com/t/perspective-module-reading-writing-to-predefined-tags-outside-of-binding/56928/4 "2022-03-07T22:15:47Z")

</div>

Hm. My initial thought would be to subscribe to the tags you’re interested in in your `ComponentModelDelegate` subclass, something like:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/2/e26ea812e10d9ca2cfa4aecaf6671a4a1de9f6de.png)

You’d still have to marshal your tags into some JSON structure and push them down to the frontend though. You can call `fireEvent` (from the backend) to send a custom message and payload to the frontend, then read it accordingly in your `ComponentStoreDelegate` implementation on the frontend.

If you had more data to read, then you could use Perspective’s `Fetchable` mechanism to do something like what you mentioned in your first post (so that the large chunk of data isn’t going over the websocket), but for a few tag values that shouldn’t be necessary.

---

<div class="post-metadata">

**Author:** ![cthomas](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@cthomas](https://forum.inductiveautomation.com/u/cthomas)\
**Post date:** [March 8, 2022, 6:28pm UTC](https://forum.inductiveautomation.com/t/perspective-module-reading-writing-to-predefined-tags-outside-of-binding/56928/5 "2022-03-08T18:28:16Z")

</div>

I read through the javadoc for the `FetchableCacheImpl` class… it looks like the link it generates for the fetchable data disappears after the first access?

[https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.0/com/inductiveautomation/perspective/gateway/comm/FetchableCacheImpl.html](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.0/com/inductiveautomation/perspective/gateway/comm/FetchableCacheImpl.html)

I’m not sure that would work for this particular use case… the number of tags would only be on the order of ~100 mostly float tags, but there could be multiple (4-6) clients using the component to read the data, and data refresh I’d expect to be on the order of 2-5hz. Would you expect `Fetchable` to be able to keep up?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 8, 2022, 6:46pm UTC](https://forum.inductiveautomation.com/t/perspective-module-reading-writing-to-predefined-tags-outside-of-binding/56928/6 "2022-03-08T18:46:09Z")

</div>

I don’t think you need fetchable. Since you’re sending relatively little data relatively often, I think it would be fine to go on the websocket. Just `fireEvent` from the Java side with your latest values, and unpack them in the component.
