# Keeping rows together when new data added

**URL:** <https://community.glideapps.com/t/keeping-rows-together-when-new-data-added/24175>\
**Category:** Ask for Help\
**Created:** [March 12, 2021, 10:07pm UTC](https://community.glideapps.com/t/keeping-rows-together-when-new-data-added/24175 "2021-03-12T22:07:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rich\_Dixon](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/rich_dixon/32/23025_2.png) [@Rich\_Dixon](https://community.glideapps.com/u/Rich_Dixon)\
**Post date:** [March 12, 2021, 10:07pm UTC](https://community.glideapps.com/t/keeping-rows-together-when-new-data-added/24175/1 "2021-03-12T22:07:07Z")

</div>

My app tracks miles for a challenge. It imports user name and goal and alphabetizes via a query from a data sheet. There’s a third column for miles which is entered from the app by user.

Problem: how do I keep the miles with the correct user when new data is added? Currently, when a new name is added the NAME and GOAL columns are re-alphabetized. But the MILES data doesn’t stay with its owner.

Thanks for any help.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [March 12, 2021, 10:30pm UTC](https://community.glideapps.com/t/keeping-rows-together-when-new-data-added/24175/2 "2021-03-12T22:30:45Z")

</div>

What’s the purpose of creating a separate sheet via a query? Mixing rows created from a query with other columns filled from the app will get you in a whole lot trouble since there is no link between the queried data and the non-queried data.

Are you trying to sort your data for use inside the app or use outside of the app? Any reason for not using the apps built-in sorting functionality?

---

<div class="post-metadata">

**Author:** ![Rich\_Dixon](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/rich_dixon/32/23025_2.png) [@Rich\_Dixon](https://community.glideapps.com/u/Rich_Dixon)\
**Post date:** [March 12, 2021, 10:39pm UTC](https://community.glideapps.com/t/keeping-rows-together-when-new-data-added/24175/3 "2021-03-12T22:39:51Z")

</div>

That’s EXACTLY my problem!

Apparently the built-in sort is new? I’ll do some research, but here’s what I see as an immediate problem.

I’m not showing last names, just first name & last initial. So not sure how sort will work. Thanks for pointing me in that direction.

Can the app sort on a column that’s not displayed?

---

<div class="post-metadata">

**Author:** ![Drearystate](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/drearystate/32/49605_2.png) [@Drearystate](https://community.glideapps.com/u/Drearystate)\
**Post date:** [March 12, 2021, 10:40pm UTC](https://community.glideapps.com/t/keeping-rows-together-when-new-data-added/24175/4 "2021-03-12T22:40:29Z")

</div>

Maybe make it increment the miles under the same user instead of adding additional logs.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [March 12, 2021, 10:48pm UTC](https://community.glideapps.com/t/keeping-rows-together-when-new-data-added/24175/5 "2021-03-12T22:48:52Z")

</div>

Sort has been there at least a couple of years as far as I know. Definitely not new.

You can create a template column of First/Last or Last/First and use that template column to sort your list.

> **[Sort](https://docs.glideapps.com/all/reference/design-and-structure/sort)**
>
> Sort your lists based on criteria

I would completely avoid using a query sheet if at all possible. You already have the data in the original sheet, so that is where you should be updating the miles.
