User adds to an existing field

I’m new to Glide. My app is a list of people and miles they run/walk/bike.

How can a user update their miles without having to “do the math”? In other words…I need a way for a user to enter NEW MILES and have the app add it to the existing total.

Should be simple, but I can’t figure it out.

Thanks.

Depending on how your data is set up, a relation column from the user to the data, and a rollup column that uses the relation and sums the total miles should be all that you need.

Hey Jeff, thanks for the response. I’m afraid I still don’t understand. Trying to research, but perhaps you can guide me a bit.

My data just has info for each user which includes a column for TOTAL MILES. I’d like a simple way for a user to enter NEW MILES and have that added to TOTAL MILES and then overwrite with the new total.

Perhaps you can point me to a tutorial or an example?

Thhanks.

How do you track mileage? Do you have a user sheet and a log sheet where you add a new row each time a user does an activity? Or is there no history log and you trying to do everything on one row?

Either way will work, but I need to understand your data layout first.

Currently, user just adds NEW MILES from the edit screen. And I would like that added to EXISTING MILES and then have the sum overwrite the old value for EXISTING MILES.

No need for a log of each week’s activity. In fact, I’d want the value of NEW MILES to return to 0.

I’d like to have a button that says ADD MILES but seems like buttons can’t do that?

Thanks.

Ok, all of the following will be on the Details/View screen. We won’t be adding the new miles in an Edit screen.

  • So in this case what I would do is create a user specific column to temporarily hold the New Miles value.
  • Then you can create a number entry component on the screen and point it to the new column you created. This is where the user will enter their New Miles.
  • Then you can create a button that will add the miles to the existing miles.
    • You will need to create a custom action on the button.
    • The first action will be to use the Increment action to increment the Existing Miles by the value in the user specific New Miles columns.
    • The second action will be to use the Set Columns action to clear the New Miles column value.
    • The last action could be a Notification action to show a popup that the miles were added.

There is a slightly more involved way to do this as well. It would be the same user specific column, but instead of the Increment action, you could create a math column that would add the existing miles and new miles together. Then the button action would just be a Set Column action that would write that math column value to the Existing Miles column, followed by clearing the New Miles column and showing the notification. Either way works, but the first method above would probably be better in this case.

2 Likes

This is AWESOME! Thanks so much.

1 Like