# How to take first row of a querry tag and write it to a similar memory dataset tag? on Value Changed script

**URL:** <https://forum.inductiveautomation.com/t/how-to-take-first-row-of-a-querry-tag-and-write-it-to-a-similar-memory-dataset-tag-on-value-changed-script/29369>\
**Category:** Ignition\
**Created:** [October 24, 2019, 6:05pm UTC](https://forum.inductiveautomation.com/t/how-to-take-first-row-of-a-querry-tag-and-write-it-to-a-similar-memory-dataset-tag-on-value-changed-script/29369 "2019-10-24T18:05:25Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [October 25, 2019, 12:23am UTC](https://forum.inductiveautomation.com/t/how-to-take-first-row-of-a-querry-tag-and-write-it-to-a-similar-memory-dataset-tag-on-value-changed-script/29369/5 "2019-10-25T00:23:27Z")

</div>

> [@wking](#):
>
> Am i going the wrong way about this?

I think so. Your mem tag is going to get clobbered every time the original query runs. Editing tables in place is tricky with bindings. Consider just showing the source query to your users in a read-only table. (With the query right there on the table, not a tag.) When they pick a row other than the first, enable the buttons and/or editable fields for their task. When that task is done, script an update query on the source table (marking that row done or whatever), then fire a refresh on the table's sql binding so that row will disappear.

If the task involves editing some of that row data, do it one at a time, and consider using the raw/dirty technique described here:

> [@Bidirectional SQL binding firing too soon](http://forum.inductiveautomation.com/t/bidirectional-sql-binding-firing-too-soon/28953/4):
>
> The technique I use in Ignition to distinguish regular binding traffic from user input is to never bind a user input field directly to a source of data. I always place a custom property of the appropriate type on that field, usually named “raw”, and bind that to the source. Bidirectionally if a tag. Then I bind the input field’s editable property uni-directionally to the raw property. With the above, a property change script that captures a change to the input field property first checks if …

{ What's with the two 'r's in query, btw? }

---

_[View the full topic](https://forum.inductiveautomation.com/t/how-to-take-first-row-of-a-querry-tag-and-write-it-to-a-similar-memory-dataset-tag-on-value-changed-script/29369)._
