Deleting Data Rows

Hi fellow Gliders,
Last year I created a Glide app to keep track of one medication intake.
Because of health problems, for the last 4-6 months, I did not do anything with Glide.
I know and can see, that many things have changed.
I noticed that these last few weeks, the calculation was getting slow.
So I removed some rows from my Google Sheets.
Then things are speeding up again.
I will try to keep my question as short as possible, but I hope it is still clear.
There is one medication that I am using, that I take 3x a day.
Every time I take this medication, it will remove 3 tablets from what I have in stock.
Once a month, I will add new tablets. 270 pieces.
As you can imagine, the data rows are going up nicely, so the stock calculation is slow.
Now, I was thinking of removing all data rows that are older than 14 days.
The reason I am using Google Sheets is, so I can easily edit/add/remove data when needed.
But maybe it is better to use Glide Tables instead?
If so, then I need to redesign some things.
But for now, is there a quick and easy way in the app, to remove data rows that are older than 14 days?
If so, how could I do this?
As I mentioned, I did not use Glide for a while, so I hope you can explain things in an easy and simple way.
Many thanks in advance for your help and time.

Hi Pierre, I think you might be able to do this all within one row… let me see if I can work out what I’m thinking and I’ll get back to you soon. To clarify you want to:

  • Add new quantity to your stock (approximately 270 every month but adding it manually)
  • Record when you take a medication
  • View history of medication taken over the last 14 days
  • Don’t care about retaining data older than 14 days ago

Do I have that correct?

Hi @MatthewS,
Correct.
I have tried to make a screenshot of the data and a screenshot of the app;


This is the data. As you see, everything is in one row


The screen of the app, so you can see how I use the data.

Maybe the data could be better or different, but the way it is now is working good for me.

As you can see in the app screenshot, I also keep track of other things, but I don’t want any changes in those.

Many thanks in advance for your help. :slight_smile:

It would be very easy to turn this into a FIFO (first in first out) rotating log. Here is how:

  • Create a rollup column that takes the Earliest from your Date_Time column
  • Create a Single Relation that matches the Rollup Column with the Date_Time column.
  • Now change the action on your “Take 3 Capsules” button. Make the first step a Delete Row Action, deleting the row via the Single Relation. And the second step can be whatever it does now.

The effect of the above will be that every time you tap the button, the oldest row in the table will be deleted.

4 Likes

Hi @Darren_Murphy,
Thanks for your reply.
I have created the rollup that takes the earliest for my date_time column
Now I am trying to create the Single Relation that matches the Rollup Column with the Date_Time column.


As a result, I am getting -3.
Is this correct?
It looks like there is something wrong, but I am not sure.

Hello again,

Here’s the solution I was thinking of, using one row for the medication, and one helper table to display the records. It would have to get reworked for more users and more medications, but I think it does what you’re asking it to do and only costs one update per medication intake.

Hope that helps!

3 Likes

Oh, could perhaps do it your way in one update as well (I don’t think others are so update conscious, but with my apps I am :stuck_out_tongue: )

Rather than have the rollup and rel help you find what row to delete… could use that to find which row to update. Set column values to the oldest record, making it the newest record without ever having created or deleting a row. Also no helper table needed. It would be a little odd that the sheet wouldn’t be in order, but I don’t see that actually mattering.

It looks nice
But for me, this looks complicated. (sorry)
I like the use of the calendar, maybe it is something to look into later.
As you can see, I already started with the way Darren_Murphy explains it, but I think it goes wrong somewhere.
Or maybe I did something wrong.
Because of different health conditions, my mind is not as sharp as it was. So I am trying to keep things simple.
And sometimes, even the simple things don’t click with me. :frowning:
Because I am almost there with Darren_Murphy’s solution, I want to get that right first :slight_smile:

It’s ok, I’m just aspiring to be like Darren :slight_smile:

I don’t think my method is too complicated, especially with each step and column shown… But I do see good reasons to stick with Darren’s method. Besides it working fine and you having already started it, it is more in line with what your app already does. Add rows as you are, and his method just shows how to append an action to delete the oldest record, which is exactly what you wanted to do.

The calendar part is pretty easy to add if you want to. It’s just another collection like the list you have.

1 Like

I think that looks right. When a successful relation is formed it will return a random value from that row. To confirm for yourself what you could do is click on the value that is returned… in this case it is “-3”

When you click on “-3” it should show you more information about the row you are linked to.

E.g.

2 Likes

You are right.
When I click on it, it will show all the details of that row :slight_smile:
Learned something again. :slight_smile:

1 Like

You could even make edits directly through that relation :wink:

It worked :slight_smile:
Thanks

I also just noticed, that in my Google Sheet, it is now showing a empty row.
Is there maybe a way that that empty row can be deleted?
Or do I just need to remove it myself, or maybe do a manual sync?
(I just did a manual sync, but the empty row in my Google Sheet is still there)
Maybe I need to try to convert everything to a Glide Table.

You would have to remove it yourself.

From what I can see of your setup (and to keep things simple) I would just manually delete the empty rows once or twice a year.

Would be pretty easy… filter → select Blank

and yes… if you switch to Glide tables the rows would be completely removed with the same action but that seems like a lot more work

3 Likes

Can you maybe explain how you did this?
Right now, I have an inline list and if I set this (on the right) to “calendar”, I get the dates in a list and not like how you had displayed it, in squares.
Maybe I am missing something.
I don’t know if it is relevant, but I am using the free plan.

I think Matthews Calendar view is only available in new apps/ pages. It sounds like you might be using a classic app

1 Like

Yes, when you delete a row from Glide in a table that’s connected to a Google Sheet, Glide just clears the row. So it does leave “holes” in your Google Sheet. A manual sync won’t remove empty rows, you need to either remove them manually or automate it using something like Apps Script.

If you’re using my method, it should be always clearing the last row (assuming you add them in date order), so manually deleting empty rows shouldn’t be too much of a chore?

3 Likes

You are right. This is an “older” app, and it is showing “Classic” in my projects.
Maybe when I am in a good mood, I will maybe try to recreate the app in the new style.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.