# Writing Scaled OPC tag from Memory tag

**URL:** <https://forum.inductiveautomation.com/t/writing-scaled-opc-tag-from-memory-tag/69142>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [January 30, 2023, 11:55am UTC](https://forum.inductiveautomation.com/t/writing-scaled-opc-tag-from-memory-tag/69142 "2023-01-30T11:55:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Mulcahy](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@Thomas\_Mulcahy](https://forum.inductiveautomation.com/u/Thomas_Mulcahy)\
**Post date:** [January 30, 2023, 11:55am UTC](https://forum.inductiveautomation.com/t/writing-scaled-opc-tag-from-memory-tag/69142/1 "2023-01-30T11:55:19Z")

</div>

Hi,

I have a quick question regarding tags, and scaling.

We have a system where we have a SPEED tag and a SPEED\_SET tag coming from a PLC.

The SPEED tag, which is read-only and comes in as 2000-5000, which I can scale to 40-100% fine.

The issue comes with the SPEED\_SET tag. It is expecting 2000-5000. We have a slider that is in the range 40-100(%).

So my question is, how could I map 40-100 -\> 2000-5000 -\> Write to SPEED\_SET (OPC Tag)?

My current solution is to have the SPEED\_SET bind to the slider (40-100), then create a derived tag, which scales the SPEED\_SET to 2000-5000, then use an OnValueChanged script to write this to the OPC tag.

Is this the best solution, or am I not seeing something?

Note: I can't bind the derived tag to the slider, as this means the scale goes from 2000-5000, and I cannot do the scaling in the slider itself, as this seems to disable the 'bi-directional' property.

It seems that the derived tag is the only way to have scaling on read and write independently, but this is not enough.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 30, 2023, 1:32pm UTC](https://forum.inductiveautomation.com/t/writing-scaled-opc-tag-from-memory-tag/69142/2 "2023-01-30T13:32:39Z")

</div>

Every OPC tag can have linear scaling applied to it, which is fully bidirectional. Use this on both tags, so the underlying 2000-5000 values are completely hidden. Do be sure to set the tag type float.

---

<div class="post-metadata">

**Author:** ![Thomas\_Mulcahy](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@Thomas\_Mulcahy](https://forum.inductiveautomation.com/u/Thomas_Mulcahy)\
**Post date:** [January 30, 2023, 1:48pm UTC](https://forum.inductiveautomation.com/t/writing-scaled-opc-tag-from-memory-tag/69142/4 "2023-01-30T13:48:38Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/5/d5f6c203d36ffdb80f113694051b33048863f4b7.png)

Like this? I have set it to a memory tag for now.

The slider is a 100% and it is showing a value of 2.0

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 30, 2023, 2:10pm UTC](https://forum.inductiveautomation.com/t/writing-scaled-opc-tag-from-memory-tag/69142/5 "2023-01-30T14:10:44Z")

</div>

Looks like you have raw and scaled backward.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 30, 2023, 2:11pm UTC](https://forum.inductiveautomation.com/t/writing-scaled-opc-tag-from-memory-tag/69142/6 "2023-01-30T14:11:46Z")

</div>

Your value source is Memory. The scaling operations only apply to OPC tags.

---

<div class="post-metadata">

**Author:** ![Thomas\_Mulcahy](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@Thomas\_Mulcahy](https://forum.inductiveautomation.com/u/Thomas_Mulcahy)\
**Post date:** [January 30, 2023, 3:19pm UTC](https://forum.inductiveautomation.com/t/writing-scaled-opc-tag-from-memory-tag/69142/7 "2023-01-30T15:19:00Z")

</div>

I can see it changing now, I did not realise that it only applies to OPC values.

Also, when changing the slider now, there is a green box stating, good write pending. Is there anyway I can not show this to the user?
