# Update calculated columns after form submission

**URL:** <https://community.glideapps.com/t/update-calculated-columns-after-form-submission/78830>\
**Category:** Ask for Help\
**Created:** [December 28, 2024, 9:17am UTC](https://community.glideapps.com/t/update-calculated-columns-after-form-submission/78830 "2024-12-28T09:17:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juglugs](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/juglugs/32/83373_2.png) [@Juglugs](https://community.glideapps.com/u/Juglugs)\
**Post date:** [December 28, 2024, 9:17am UTC](https://community.glideapps.com/t/update-calculated-columns-after-form-submission/78830/1 "2024-12-28T09:17:51Z")

</div>

Hello,

I can’t quite believe I haven’t found this in a search, so forgive me I must be cocking up the search input.

I have a very simple app that tracks the mileage on my lease car.  
I’m trying to have a form where the user simply enters the current mileage - the date field is pre-populated with “now”:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/1/b1cee57db43d16397590750553cce46e721073a6.png)

It adds a new row correctly but only populates the `Date` and `Actual Mileage` columns.  
I want to update the columns `Origin Date` (to the standard “26 August 2022”), and then calculate `Date Diff`, `Target Mileage`, `Old Mileage`, `Change`, and `Spare Miles`.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/c/fc5559b48d8327edbd5e72a2972be9619fd1b9d9.png)

I assume I need to add these columns to the “additional columns” part of the form, but I don’t see how to do that?  
And then, once they’re added, how do I trigger the calculation function of those columns to update that row entry?

As a cherry on top, the form seems to persistently keep the “now” date in the field unless I physically close the app and re-open it. Can I reset it to update whenever the form is visible?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [December 28, 2024, 10:04am UTC](https://community.glideapps.com/t/update-calculated-columns-after-form-submission/78830/2 "2024-12-28T10:04:28Z")

</div>

> [@Juglugs](#):
>
> I want to update the columns `Origin Date` (to the standard “26 August 2022”), and then

If that’s a fixed date, then there is really no reason to add it with every new row. Do you have User Profiles configured? Assuming yes, then what I would do is add a datetime column in the Users table, add that date to it, and then you can refer to that directly in your calculations without even needing that column in your Miles table.

> [@Juglugs](#):
>
> I assume I need to add these columns to the “additional columns” part of the form, but I don’t see how to do that?  
> And then, once they’re added, how do I trigger the calculation function of those columns to update that row entry?

You don’t need to add data to computed columns, and in fact you can’t. Computed columns will automatically calculate for each new row that is added. If you understand how arrayformulas work in spreadsheets, it’s a similar concept.

> [@Juglugs](#):
>
> As a cherry on top, the form seems to persistently keep the “now” date in the field unless I physically close the app and re-open it. Can I reset it to update whenever the form is visible?

I’m not sure I understand. Are you saying that the `now` value doesn’t change?  
Can you show me how you configured that date picker component?

---

<div class="post-metadata">

**Author:** ![Juglugs](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/juglugs/32/83373_2.png) [@Juglugs](https://community.glideapps.com/u/Juglugs)\
**Post date:** [December 28, 2024, 11:44am UTC](https://community.glideapps.com/t/update-calculated-columns-after-form-submission/78830/3 "2024-12-28T11:44:27Z")

</div>

I don’t know how you split my question up and answered parts of it, but it’s very cool! So maybe you would be so kind to explain that to me as well?

Anyway, the `Origin Date` column and your suggestion was the key to my problem! By adding the single value to my Users Profile, it solved everything and the calculated columns updated as expected - It was that value not being populated that prevented any other columns from calculating. Thank you so much!

For the `Now` (actually `Today`) problem, see my config screen below:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/2/92cd63812b04f26ac814907451353d2c52d74e00.png)

I’ve set the default value to `Today` which I expected to update every time I visited the form screen. However, if I make an entry today on the app, and then go to the form tomorrow, that field still says 28/12/2024. I have to actually close the app on my phone (swipe it up and away) and re-open it to get the correct date.

---

<div class="post-metadata">

**Author:** ![Juglugs](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/juglugs/32/83373_2.png) [@Juglugs](https://community.glideapps.com/u/Juglugs)\
**Post date:** [December 28, 2024, 11:46am UTC](https://community.glideapps.com/t/update-calculated-columns-after-form-submission/78830/4 "2024-12-28T11:46:59Z")

</div>

I’ve just noticed that if I clear the date that’s already populated by using the ‘x’ in the field, and then go to a different screen and then back to the form, it populates correctly. So do I need to do something to clear that field after the form submission?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [December 28, 2024, 12:02pm UTC](https://community.glideapps.com/t/update-calculated-columns-after-form-submission/78830/5 "2024-12-28T12:02:32Z")

</div>

> [@Juglugs](#):
>
> I don’t know how you split my question up and answered parts of it, but it’s very cool! So maybe you would be so kind to explain that to me as well?

Use your mouse or trackpad to highlight the text you want to reply to, then click on “Quote”, like below:

 ![CleanShot 2024-12-28 at 19.53.26@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/d/1d3c098eac170f338e0bb251d0444a6c64cad650.png)

> [@Juglugs](#):
>
> Anyway, the `Origin Date` column and your suggestion was the key to my problem! By adding the single value to my Users Profile, it solved everything and the calculated columns updated as expected - It was that value not being populated that prevented any other columns from calculating. Thank you so much!

Excellent!  
Just one thing that occurred to me after posting my previous reply - would that date ever change?  
If it’s _always_ going to be 26 August 2022, then what you have now is fine. You just need to be aware that if you ever changed that date then every row in your Miles table would instantly recalculate based on the new date. If you need to cater for that changing, then I can offer an alternative solution.

> [@Juglugs](#):
>
> I’ve just noticed that if I clear the date that’s already populated by using the ‘x’ in the field, and then go to a different screen and then back to the form, it populates correctly. So do I need to do something to clear that field after the form submission?

To be honest, I’m not really sure what’s going on there, sorry. The behaviour seems a bit odd. I don’t often use a Form Container, so perhaps there is something special about the way that behaves that I’m not aware of 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![Juglugs](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/juglugs/32/83373_2.png) [@Juglugs](https://community.glideapps.com/u/Juglugs)\
**Post date:** [December 28, 2024, 12:09pm UTC](https://community.glideapps.com/t/update-calculated-columns-after-form-submission/78830/6 "2024-12-28T12:09:57Z")

</div>

> [@Darren\_Murphy](#):
>
> Use your mouse or trackpad to highlight the text you want to reply to, then click on “Quote”

Ah-ha! That’s amazing, thanks!

> [@Darren\_Murphy](#):
>
> Just one thing that occurred to me after posting my previous reply - would that date ever change?

No, it’s the date I received the car - I just need to know that I’m on track not to exceed my 10,000 miles per year agreement so I’m calculating against the days since I received the car and the current date to give me the expected total miles for today. (Obviously, I can go over as long as it’s under 30k after 3 years - this app is just a guide)

> [@Darren\_Murphy](#):
>
> To be honest, I’m not really sure what’s going on there, sorry. The behaviour seems a bit odd. I don’t often use a Form Container, so perhaps there is something special about the way that behaves that I’m not aware of 🤷‍♂️

The workaround of deleting the value and then switching screens is fine for now - I’ll play with it some more to see if I can figure out a more elegant (proper) solution and post it here if I find it.

Thanks for all your help on this!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [January 4, 2025, 12:10pm UTC](https://community.glideapps.com/t/update-calculated-columns-after-form-submission/78830/7 "2025-01-04T12:10:28Z")

</div>

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