# Value is changed in numeric entry field when run perspective project but it is not updated in tag Browser or not changed value update in OPC

**URL:** <https://forum.inductiveautomation.com/t/value-is-changed-in-numeric-entry-field-when-run-perspective-project-but-it-is-not-updated-in-tag-browser-or-not-changed-value-update-in-opc/82834>\
**Category:** General Discussion\
**Tags:** perspective\
**Created:** [December 7, 2023, 1:01pm UTC](https://forum.inductiveautomation.com/t/value-is-changed-in-numeric-entry-field-when-run-perspective-project-but-it-is-not-updated-in-tag-browser-or-not-changed-value-update-in-opc/82834 "2023-12-07T13:01:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swathi\_G](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@Swathi\_G](https://forum.inductiveautomation.com/u/Swathi_G)\
**Post date:** [December 7, 2023, 1:01pm UTC](https://forum.inductiveautomation.com/t/value-is-changed-in-numeric-entry-field-when-run-perspective-project-but-it-is-not-updated-in-tag-browser-or-not-changed-value-update-in-opc/82834/1 "2023-12-07T13:01:29Z")

</div>

Hello  
I have added this script in Add Transform-\>Script so now datatype mismatch error (For FloatArray data type)is not occured , when I run project and change numeric entry field then value is changed but in tag browser it is not reflected changed value, why this is happening any reason behind this? If anyone knows this then let me know.

this is my Script:

```auto
def transform(self, value, quality, timestamp):

	opcTagPath = "[Sample_Tags]TO_LVF_CIT_N[0].value"
	currentValues = system.tag.readBlocking([opcTagPath])[0].value
	last_char = self.name[-1]
	if last_char.isdigit():
	    elementIndex = int(last_char) - 1
	        # Update the specific element in the array based on the Numeric Entry     
                         Field's name
	    currentValues[elementIndex] = float(value)
	        # Write the updated array back to the OPC tag
	    system.tag.writeBlocking([opcTagPath], [currentValues])
	
	return value

```

So when I added script via Add Transform-\>Script then Bidirectional button is disable , so why it is not write changed value

**Here self.name retrives the name property of the component, which is unique identifier for that component**

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 7, 2023, 1:04pm UTC](https://forum.inductiveautomation.com/t/value-is-changed-in-numeric-entry-field-when-run-perspective-project-but-it-is-not-updated-in-tag-browser-or-not-changed-value-update-in-opc/82834/2 "2023-12-07T13:04:43Z")

</div>

Swathi, when you are pasting code you need to select the code block and press the \</\> button. Most of your code formatted correctly because there were leading spaces but the first line did not.

What does `self.name` look like? Is it `[Sample_Tags]TO_LVF_CIT_N[0]` as shown in the sample code?

You probably should not `return value`. It's already there.

---

<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 7, 2023, 1:31pm UTC](https://forum.inductiveautomation.com/t/value-is-changed-in-numeric-entry-field-when-run-perspective-project-but-it-is-not-updated-in-tag-browser-or-not-changed-value-update-in-opc/82834/3 "2023-12-07T13:31:34Z")

</div>

Transforms are fundamentally unidirectional.

---

<div class="post-metadata">

**Author:** ![Swathi\_G](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@Swathi\_G](https://forum.inductiveautomation.com/u/Swathi_G)\
**Post date:** [December 7, 2023, 2:31pm UTC](https://forum.inductiveautomation.com/t/value-is-changed-in-numeric-entry-field-when-run-perspective-project-but-it-is-not-updated-in-tag-browser-or-not-changed-value-update-in-opc/82834/4 "2023-12-07T14:31:09Z")

</div>

ok so that changed values are not written, so is there any other way to add this script without this transform? Because onchange event is not there in configure events.

---

<div class="post-metadata">

**Author:** ![Swathi\_G](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@Swathi\_G](https://forum.inductiveautomation.com/u/Swathi_G)\
**Post date:** [December 7, 2023, 2:31pm UTC](https://forum.inductiveautomation.com/t/value-is-changed-in-numeric-entry-field-when-run-perspective-project-but-it-is-not-updated-in-tag-browser-or-not-changed-value-update-in-opc/82834/5 "2023-12-07T14:31:39Z")

</div>

Here self.name retrives the name property of the component, which is unique identifier for that component

---

<div class="post-metadata">

**Author:** ![Swathi\_G](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@Swathi\_G](https://forum.inductiveautomation.com/u/Swathi_G)\
**Post date:** [December 9, 2023, 2:38pm UTC](https://forum.inductiveautomation.com/t/value-is-changed-in-numeric-entry-field-when-run-perspective-project-but-it-is-not-updated-in-tag-browser-or-not-changed-value-update-in-opc/82834/6 "2023-12-09T14:38:21Z")

</div>

Hello I have one doubt regarding data type mismatch error  
Here I have attched two images  
 ![51](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/a/eaf841737a253493961024f50a0aa887b2182d31.jpeg)

The values of TO\_LVF\_CIT that are coming from OPC UA is in float array so when I see entries in tag browser then it will show Error\_typeConversion so that I have cretaed new OPC tag via tag browser in which i have select Float Array as a datatype so it's values are showing properly

 ![52](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/8/e8d2fb3001becb9c5705eee458994372a3895321.jpeg)

Now I bind one by one value in different numeric entry field and add this script in onActionPerfromed but still datatype mismatch error occured when i run project and change numeric entry field value , so any reason behind this?

```auto
def runAction(self, event):
	# Specify the OPC tag path for the first element
		
	opcTagPath = "[Sample_Tags]TO_LVF_CIT_N[0]"
	currentValue = system.tag.readBlocking([opcTagPath])[0].value	
	newValue = float(self.props.value)
	
	logger = system.util.logger("MyScriptLogger")		
	try:		
		logger.info("Updating tag: {}, newValue: {}".format(opcTagPath, newValue))		
	except Exception as e:	
		logger.error("Error updating OPC tag: {}".format(e), exc_info=True)
			
	system.tag.writeBlocking([opcTagPath], [newValue])

```

any version related issues are there that not support Float array data type??
