# Edit dataset, then copy to SQL?

**URL:** <https://forum.inductiveautomation.com/t/edit-dataset-then-copy-to-sql/26494>\
**Category:** Ignition\
**Created:** [July 11, 2019, 9:11pm UTC](https://forum.inductiveautomation.com/t/edit-dataset-then-copy-to-sql/26494 "2019-07-11T21:11:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [July 11, 2019, 9:11pm UTC](https://forum.inductiveautomation.com/t/edit-dataset-then-copy-to-sql/26494/1 "2019-07-11T21:11:44Z")

</div>

Looking for advice, and direction as well. Using 7.9.10, MySQL. I have a table with several rows that I allow changes. Right now you don’t edit the from within table, yet with selected row I move data into dropdown boxes, text boxes, etc. Then they enter values here and hit submit, which just writes back to the table. This is fine except it can be cumbersome as they have to save each row at a time. Is it possible to copy the table to another dataset, then have them edit this dataset and when they are ready to copy the entire dataset back to the table?

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [July 11, 2019, 9:19pm UTC](https://forum.inductiveautomation.com/t/edit-dataset-then-copy-to-sql/26494/2 "2019-07-11T21:19:48Z")

</div>

Why not have your dropdowns, text boxes, etc write back to the table dataset with setValueAt?  
Then at the end have a button that loops the table and writes the changes to the database?

---

<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:** [July 11, 2019, 9:46pm UTC](https://forum.inductiveautomation.com/t/edit-dataset-then-copy-to-sql/26494/3 "2019-07-11T21:46:56Z")

</div>

> [@MMaynard](#):
>
> setValueAt

This should not be used on any dataset that is referenced anywhere. You won't get propertyChange events and references will be changed behind the backs of other instances. Datasets are defined to be immutable for a reason.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [July 11, 2019, 10:45pm UTC](https://forum.inductiveautomation.com/t/edit-dataset-then-copy-to-sql/26494/4 "2019-07-11T22:45:30Z")

</div>

Thanks guys, the table is bound to a SQL query. Is it a good idea to copy the table to another dataset, use it to edit, then send back to the table?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 12, 2019, 11:58am UTC](https://forum.inductiveautomation.com/t/edit-dataset-then-copy-to-sql/26494/5 "2019-07-12T11:58:03Z")

</div>

If you're going the two-dataset route, this thread my help you out.

> [@Comparing Two Datasets Values, and using those to determine difference](http://forum.inductiveautomation.com/t/comparing-two-datasets-values-and-using-those-to-determine-difference/23676):
>
> Hi, I need to compare two datasets in a power table. in this table the user inputs parts and qty for an order. what i want to do it is the following. This Dataset are for the Power Table SelDS=Query from DB were ordernumber=value (polling Off) EmptyDS= a five column empty dataset Table.data = (Power Table dataset) if the order is being edited(Meaning the table already has values in it SelDS saved. Table in Ignition (SelDS) [image] let’s say i change the value of the Case to Ship column …

IMO, it would be less hassle to make the table editable, and write back to the db using onCellEdited (assuming Power Table).

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [July 12, 2019, 1:15pm UTC](https://forum.inductiveautomation.com/t/edit-dataset-then-copy-to-sql/26494/6 "2019-07-12T13:15:34Z")

</div>

Is there a reason not to edit directly in the original table and just have it write back to the database as the edits are done? You can still create drop downs for data selection in the table and do a table refresh after the data is written so you know it gets to the database.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [July 13, 2019, 1:02pm UTC](https://forum.inductiveautomation.com/t/edit-dataset-then-copy-to-sql/26494/7 "2019-07-13T13:02:35Z")

</div>

In my experience editing directly has been a little flaky, especially with dropdowns, perhaps something I had done wrong. However, what I haven’t been able to get is validation, how do you do bounds, meaning clamp entries from a min/max?
