# Dataset row value changes as data is added

**URL:** <https://forum.inductiveautomation.com/t/dataset-row-value-changes-as-data-is-added/108440>\
**Category:** Ignition\
**Created:** [July 14, 2025, 6:54pm UTC](https://forum.inductiveautomation.com/t/dataset-row-value-changes-as-data-is-added/108440 "2025-07-14T18:54:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sweetz](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@Sweetz](https://forum.inductiveautomation.com/u/Sweetz)\
**Post date:** [July 14, 2025, 6:54pm UTC](https://forum.inductiveautomation.com/t/dataset-row-value-changes-as-data-is-added/108440/1 "2025-07-14T18:54:23Z")

</div>

Hello all,

I have this application where data is updated on the text label on the screen as operator scans new parts for a stack of 8. Currently, each label has a 1 sec polling named query and I have 25-30 such screens with about 10 queries per screen which seems to be pushing limits.

I came up with a named query with several select statements with an UNION binded to a custom prop.

Select COALESCE(SUM(serial), 0) from parts where layer = :layer and layer\_pos = :layer\_pos and pallet = :pallet and stack\_pos = 1

UNION

Select COALESCE(sum(serial), 0) from parts where layer = :layer and layer\_pos = :layer\_pos and pallet = :pallet and stack\_pos = 2

UNION  
etc..up to stack\_pos=8

Say the first part is 1 and gets into Dataset[1,0]. When I scan the second part, the first part number gets moved to Dataset[2,0] and so on getting pushed down in the dataset table.

In the following, last 3 digits '492' was the first scan and it started at [1,0] and is now at [3,0]

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

Any suggestions on how to make it stay at [1,0] because that's what the label refers to?

TIA.

---

<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 14, 2025, 7:02pm UTC](https://forum.inductiveautomation.com/t/dataset-row-value-changes-as-data-is-added/108440/2 "2025-07-14T19:02:53Z")

</div>

Why are you using a DB for this? Just scan into UI custom properties as your operator builds their "stack", then write it all to the DB at the end.

---

<div class="post-metadata">

**Author:** ![Sweetz](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@Sweetz](https://forum.inductiveautomation.com/u/Sweetz)\
**Post date:** [July 14, 2025, 7:08pm UTC](https://forum.inductiveautomation.com/t/dataset-row-value-changes-as-data-is-added/108440/3 "2025-07-14T19:08:52Z")

</div>

This is already an existing system, and I am also new to Ignition. Also, they have other functions on the screen like deleting, updating position etc where they needed direct DB access.

For now, I am trying to optimize without rewriting much as more perspective sessions like this are being added causing more congestions.

---

<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 15, 2025, 12:13pm UTC](https://forum.inductiveautomation.com/t/dataset-row-value-changes-as-data-is-added/108440/4 "2025-07-15T12:13:01Z")

</div>

In that case, I would recommend (assuming you really need all the stack positions):

- Creating a table that holds all possible stack positions.
- Use a left join / subquery to return all rows of the pallet, whether a serial exists for it or not.
- Use a lookup() expression on the label to point to the correct row in the dataset.

[SQLFiddle example here](https://sqlfiddle.com/sql-server/online-compiler?id=86983bf8-20d3-4806-848e-11047daee83c):

---

<div class="post-metadata">

**Author:** ![Sweetz](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@Sweetz](https://forum.inductiveautomation.com/u/Sweetz)\
**Post date:** [July 15, 2025, 1:06pm UTC](https://forum.inductiveautomation.com/t/dataset-row-value-changes-as-data-is-added/108440/5 "2025-07-15T13:06:51Z")

</div>

Thanks Jordan.

I did exactly the same yesterday. Returning stack pos with serial from the database into dataset and used lookup function to populate serial based on stack pos.

I logged in today and you had the same thing 🙂
