# Time delay clearing fields

**URL:** https://community.glideapps.com/t/time-delay-clearing-fields/30052
**Category:** Ask for Help
**Created:** [August 5, 2021, 4:37pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052 "2021-08-05T16:37:39Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)
#### Post date: [August 5, 2021, 4:37pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/1 "2021-08-05T16:37:39Z")

</div>

I’m looking for a way to delay the clear fields action.

The app shows the user the results of the ratio calculation from the top row of the GSheet. I have an onchange trigger which clears those results when a new row containing user email, timestamp, amount of “A” and amount of “B” is added. This also clears the results from the UI. I need those results to “stick” in the UI for some amount of time as the operation the user is performing will take, lets say, 5 minutes and the user may need to refer back to the results.

My goal is to avoid having the user have to click on the form submit because they will probably forget and then the next user will have erroneous data populated which could cause confusion and/or mistakes.

So, perfect world = User enters amount of “A” and hits Calculate Dose button. Dose is calculated and displayed on the same screen and data is added to new row on Gsheet. Displayed dose data is available to user for “X” time or until app is closed.

---

<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: [August 5, 2021, 5:12pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/2 "2021-08-05T17:12:28Z")

</div>

Why don’t you use user specific columns to store the entered data, so each user can see their own version of the results? Then you don’t have to worry about each user seeing what another user entered. You wouldn’t have to worry about clearing the fields then. Each user could clear them themselves whenever they want.

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [August 5, 2021, 5:12pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/3 "2021-08-05T17:12:39Z")

</div>

you can copy one of the values at the end of the script, and write to a copy column… then in Glide, add if else column that will compare if these values are the same… this way you will know if data is sync to glide and block some elements if not…  
but as @Jeff_Hager said… is much easier in your case to use user-specific columns… unless the calculations are impossible to made in Glide table  
and why 5 min ? script will run it in a blazing speed and glide will sync it in max 5 to 10 sec…  
Also, you don’t need to use script to clear the row… use set column - clear value action

---

<div class="post-metadata">

### Author: ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)
#### Post date: [August 6, 2021, 3:24pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/4 "2021-08-06T15:24:55Z")

</div>

That’s something to think about.  
Perhaps I could set up a delete row action when they sign in to remove the previous result.

---

<div class="post-metadata">

### Author: ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)
#### Post date: [August 6, 2021, 3:29pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/5 "2021-08-06T15:29:13Z")

</div>

The Glide table will not perform the calculations required, I tried.

5 Minutes or until the app is closed is required as the task being performed can involve multiple steps and I would like them to be able to refer back to the result until they are finished.

---

<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: [August 6, 2021, 3:58pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/6 "2021-08-06T15:58:17Z")

</div>

I’m having trouble visualizing how your app is set up, but I was picturing a single row with user specific columns that take the user input and calculate the results. Then they can click a button with an add row action to save it permanently if they want. The next time they go to that screen, you could have a custom action to first clear the user specific values and then show the details screen. I wasn’t imagining any need to delete a row.

Again, I’d probably need screenshots or a video to better understand what you have and what you want.

---

<div class="post-metadata">

### Author: ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)
#### Post date: [August 8, 2021, 6:14pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/7 "2021-08-08T18:14:11Z")

</div>

Quick background on this project: This task is something that’s going to be dumped on someone who probably doesn’t want to do it and probably doesn’t give a sh\*t. I’m trying to make it as simple and easy as possible so our product is utilized properly.

OK, so this is the opening page.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/6/86c6de92ff81e1daf5b536f7a36a744bf1112d6e.png)  
User enters gallons of fuel added to tank. Hits the calculate button. As the calculation is completed automatically by the Gsheet all the button does is takes them to the results tab, but the user doesn’t need to know this.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/d/0dc882acf542341208cd7beb745c614f2e6d6c8e.png)

So I need these results to be: A) User specific so others can use the app simultaneously. B) Recorded in the Gsheet in a new row and C) Available to the user while they complete the task and then automatically cleared perhaps by a custom action as you mentioned.

Does this help?

Thank you.

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [August 8, 2021, 6:50pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/8 "2021-08-08T18:50:51Z")

</div>

A. Do calculations in user sheet, so nobody can see it and others can do their own in the same time… this way it dont need to be usc  
B. Add row with record to a data sheet  
C. Users can edit or delete that record

---

<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: [August 8, 2021, 7:03pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/9 "2021-08-08T19:03:59Z")

</div>

As @Uzo said, you could use the user profile sheet, and filter by signed in user, so you wouldn’t need USC columns, but that’s only if you require users to sign in. But if you are trying to keep it simple, I’m guessing you don’t want to have users sign in.

I would still use a user specific column to store the number of gallons. The math seems like it would be reasonably simple, so you could use a math column to calculate, in real time, the amount of enerburn needed based on the user specific column value and display the results as the user is typing. This would eliminate any delay in waiting for the sheet to recalculate and sync the result back to glide and back to the app. All you would need to save, is have a button that would write the entered gallons and the calculated values to a new sheet row. I could probably work it out in a few minutes if you have a copyable app that I can copy and modify to show what I mean.

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [August 8, 2021, 7:06pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/10 "2021-08-08T19:06:09Z")

</div>

And if you have a problem calculating using math column… use YC column with Excel formulas… as @Jeff_Hager says… you will have a delay if calculations are made in gs…  
I think he is using some query or import range to do calculations… that’s why he insists to use gs… he might be scrapping current gas prices from some websites

---

<div class="post-metadata">

### Author: ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)
#### Post date: [August 9, 2021, 11:26pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/11 "2021-08-09T23:26:10Z")

</div>

No fuel prices involved.  
I’m using GS because the glide sheet won’t do formulas like  
=(MRound(((I2\*128)/2500),0.5)) or =IF(J2\>128,(ROUNDdown((J2/128),0)),0)  
What is a YC column?

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [August 9, 2021, 11:36pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/12 "2021-08-09T23:36:25Z")

</div>

You can do that calculation in math column.  
YC … yes code (experimental column), it runs custom code

---

<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: [August 10, 2021, 12:53am UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/13 "2021-08-10T00:53:36Z")

</div>

Do you have some real examples of inputed data and the expected result so I can work out how to structure a math column?

---

<div class="post-metadata">

### Author: ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)
#### Post date: [August 10, 2021, 1:09am UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/14 "2021-08-10T01:09:19Z")

</div>

Can I message you the link to the GS?

---

<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: [August 10, 2021, 1:09am UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/15 "2021-08-10T01:09:55Z")

</div>

Sure

---

<div class="post-metadata">

### Author: ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)
#### Post date: [August 10, 2021, 1:23am UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/16 "2021-08-10T01:23:30Z")

</div>

I’m only using sheet1 for this one so far. The rest is from an app that required much more input from the user.

---

<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: [August 10, 2021, 2:04am UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/17 "2021-08-10T02:04:59Z")

</div>

This is a quick and dirty example. I’m not 100% sure on the math, but it matches all the examples in your sheet. Let me know if that looks correct and makes sense.

> **[Enerburn](https://gorgeous-wish-4682.glideapp.io/)**

---

<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: [August 10, 2021, 4:58am UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/18 "2021-08-10T04:58:05Z")

</div>

I don’t accept 1oz deviations so I made some changes. 😉

OK, I reworked the formulas and I think I have it matching the dosing table exactly. Liters is a little weird because according to the chart, everything less than 1 liter is calculated to 2 decimal places, but anything larger than 1 liter is calculated to only 1 decimal place, so I had to calculate it twice to round properly based on 1 or 2 decimal places and use an IF column to determine which calculation to use for the template results based on if the calculated liters are larger than 1 or not (could have probably done all of that in a single math column, but the formula would have been really ugly, so for simplicity I split it up and used the IF column). I also had to fix the gallon and ounce calculations to account for those edge cases where ounces round to 128 ounces instead of 0 and the gallons fail to round up when it should be, or rounds up when it shouldn’t.

I think it’s all matching the dosing chart if you want to check and compare.

For testing purposes, I added a bunch of rows to the ‘Main’ table so I can check multiple calculations at once. Those rows labeled as DELETE can be deleted.

So what my version of the app demonstrates is that a user can enter the gallons and as they type, the enerburn amount is calculated in real time. The fuel added value is written to a user specific column, so every user would see their own calculations without interfering with any other users. You could add a button to clear the column or the user could just clear it with the backspace key. Either way it will not interfere with any other users who may be using the app at the same time. Since they can clear it themselves, I see no reason to have some sort of time based trigger to clear the column, as it will be a unique experience for each user.

The Save button just uses an Add Row action to write the data to another table. You could write the Fuel Added value along with all of the calculated values to multiple columns which would be very simple to do, but my example only writes the Fuel Added value and recalculates the Enerburn values in the Log table (I only added a couple of calculated math columns to save time). I did that only because I figured you may want to allow a user to edit a saved entry, so if they edit an existing row, you would need to recalculate Enerburn values in that log table. That part is pretty much up to how you want that part of the app to flow.

Hopefully this gives you enough to play with and see how you can integrate some of that into your app.

---

<div class="post-metadata">

### Author: ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)
#### Post date: [August 11, 2021, 3:01pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/19 "2021-08-11T15:01:38Z")

</div>

Jeff,  
Thank you for your help. This is fantastic.

---

<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: [August 11, 2021, 3:08pm UTC](https://community.glideapps.com/t/time-delay-clearing-fields/30052/20 "2021-08-11T15:08:12Z")

</div>

We wouldn’t expect anything less from [Chuck](https://community.glideapps.com/t/chuck-norris-aka-jeff/26818) 😉

[Next page](https://community.glideapps.com/t/time-delay-clearing-fields/30052.md?page=2)
