# How to mirror Float Tag to a scaled Short Tag

**URL:** <https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [December 16, 2022, 4:09pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718 "2022-12-16T16:09:05Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wesley\_Waters](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wesley_waters/32/38300_2.png) [@Wesley\_Waters](https://forum.inductiveautomation.com/u/Wesley_Waters)\
**Post date:** [December 16, 2022, 4:09pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718/1 "2022-12-16T16:09:05Z")

</div>

I feel like I am making something that should be simple way more complex than it needs to be.

I have a memory tag that is a float and I want another tag (short) to have that value but multiplied by 1000.

Example:  
The below is what I want..  
MemoryTag = 3.125  
OPCShortArray[3] = 3125

What is the best way to accomplish this?

I have attempted putting a change script into the Memory Tag, but I have had no success with that. When I run the script in the script console it works but nothing happens when I put the same script in the change script for the memory tag. I have tried changing it to tell it that the path is [Edge]Path, [~]Path, and [Gateway Scripting Project Name]Path.. none of the above is working.

---

<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:** [December 16, 2022, 4:18pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718/2 "2022-12-16T16:18:14Z")

</div>

> [@Wesley\_Waters](#):
>
> [Edge]Path

Ignition Edge doesn't do gateway-scope scripts unless you have the compute plug-in licensed.

You probably want a derived tag.

---

<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:** [December 16, 2022, 4:18pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718/3 "2022-12-16T16:18:28Z")

</div>

Do you need an additional tag at all? With [scaling](https://docs.inductiveautomation.com/display/DOC81/Tag+Scaling+Properties), the tag appears to have the larger value at all times, but is silently read/written as the scaled value.

If you truly want a separate tag, use a [Derived Tag](https://docs.inductiveautomation.com/display/DOC81/Types+of+Tags#TypesofTags-DerivedTags).

---

<div class="post-metadata">

**Author:** ![Wesley\_Waters](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wesley_waters/32/38300_2.png) [@Wesley\_Waters](https://forum.inductiveautomation.com/u/Wesley_Waters)\
**Post date:** [December 16, 2022, 5:57pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718/4 "2022-12-16T17:57:12Z")

</div>

I have the compute plug-in, so I would think it should still work.

---

<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:** [December 16, 2022, 5:59pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718/5 "2022-12-16T17:59:28Z")

</div>

Actually, your problem may be the use of a short **array**. OPC array tags are notoriously fickle when it comes to writing to single elements (or anything less than the entire array). Test with a simple integer tag.

---

<div class="post-metadata">

**Author:** ![Wesley\_Waters](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wesley_waters/32/38300_2.png) [@Wesley\_Waters](https://forum.inductiveautomation.com/u/Wesley_Waters)\
**Post date:** [December 16, 2022, 6:00pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718/6 "2022-12-16T18:00:32Z")

</div>

I got it working with a derived Tag, but I feel like I am doing it incorrectly:

I have my memory tag that has the float value

Then I have my OPC array which has the value I want to write to.

I made a separate derived tag with the read/write using the memory tag \* 1000, then the source is set to the OPC array element I want to work with. However to get the tag to update I have to set the value of the derived tag to any arbitrary value and it will then read/write the memory tag...

I feel like I am setting something up incorrectly, but it is doing what I want it to do..

---

<div class="post-metadata">

**Author:** ![Wesley\_Waters](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wesley_waters/32/38300_2.png) [@Wesley\_Waters](https://forum.inductiveautomation.com/u/Wesley_Waters)\
**Post date:** [December 16, 2022, 6:01pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718/7 "2022-12-16T18:01:23Z")

</div>

Ok, I will test with a integer tag.. should I set that up as a memory tag also?

---

<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:** [December 16, 2022, 6:02pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718/8 "2022-12-16T18:02:31Z")

</div>

No, break your OPC array into individual tags. They your original script idea should work (using system.tag.writeBlocking...) without an intervening tag.

---

<div class="post-metadata">

**Author:** ![Wesley\_Waters](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wesley_waters/32/38300_2.png) [@Wesley\_Waters](https://forum.inductiveautomation.com/u/Wesley_Waters)\
**Post date:** [December 16, 2022, 6:04pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718/9 "2022-12-16T18:04:28Z")

</div>

The issue is that the OPC server is set up by another device which I don't have any control over.

I was attempting to break the array into individual tags by using reference tags which reference specific elements in the array that I want to be able to use. However I had the same issue when using the reference tag.

---

<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:** [December 16, 2022, 6:22pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718/10 "2022-12-16T18:22:35Z")

</div>

Let's back up. Please show your script that you originally tried, that worked in the script console. In a tag's value change, that would likely work if indented properly, and there was no reliance on any project defaults.

---

<div class="post-metadata">

**Author:** ![Wesley\_Waters](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wesley_waters/32/38300_2.png) [@Wesley\_Waters](https://forum.inductiveautomation.com/u/Wesley_Waters)\
**Post date:** [December 16, 2022, 6:27pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718/11 "2022-12-16T18:27:49Z")

</div>

system.tag.writeBlocking('[Edge]Robot/IO/Length',10)

In the change script I had the 10 replaced with currentValue. However when I ran into issues I attempted to use a constant and it still wasn't working.

I also attempted to put [~] and [Gateway Scripting Project Name] (not that actual value but the value I have in the gateway settings for that value)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [December 16, 2022, 6:37pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718/12 "2022-12-16T18:37:32Z")

</div>

> [@Wesley\_Waters](#):
>
> In the change script I had the 10 replaced with currentValue

You realize that `currentValue` is a fully qualified value meaning it has timestamp and quality values too. You should use `currentValue.value` to get just the value from the qualified tag value.

---

<div class="post-metadata">

**Author:** ![Wesley\_Waters](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wesley_waters/32/38300_2.png) [@Wesley\_Waters](https://forum.inductiveautomation.com/u/Wesley_Waters)\
**Post date:** [December 16, 2022, 6:53pm UTC](https://forum.inductiveautomation.com/t/how-to-mirror-float-tag-to-a-scaled-short-tag/67718/13 "2022-12-16T18:53:09Z")

</div>

Thank You,

I must've had something else incorrect when I tried the constant value because after I got that to work I attempted using a constant value again and it worked.

Thanks to everyone for all the help
