Add spreadsheet computed column

I’ve done a lot of programming (for an amateur) but I’m really struggling with Glide. So far I am completely confused as to how it works.

The current problem: I have a computed field in a spreadsheet (the difference between two dates). When I add a new record in Glide, the computed field in my spreadsheet is blank.

I can’t just put the computation in the column in the spreadsheet and let the spreadsheet do the work because Glide will add the row AFTER those rows that are “pre-populated” with the formula.

I’ve messed around with Glide’s computed columns and custom actions but I have not yet discovered the secret there.

Any help is appreciated.

Yours truly,

Frustrated and Confused

If you put a formula in a row in Google sheets, then that becomes a populated row. Glide won’t add rows overtop of existing populated rows because it technically contains data. You can avoid this by using arrayformulas in the google sheet and then delete all empty rows in your table. Trying to manually populate rows with a formula is not a good long term solution as it’s not scalable. Arrayformulas expand indefinitely.

However, this is a very old method, and generally we discourage doing any computations in the google sheet if you can avoid it. Using glide computed columns will give you a much better experience as those computations are instant and occur directly on the user’s device. There is no waiting for data to sync from device to glide to google, back to glide, and back to the device. That becomes a horrible user experience.

What I would use is a math column that subtracts one date column from another date column.

4 Likes

@doloo make sure you add the computed columns in Glide for real-time performance. Check the Date Difference column in this case.

When you add or edit data in glide that relies on calculations in your spreadsheet, Glide has to wait up to three minutes for updated calculations to sync back from Google. When you perform the calculations in Glide, they update immediately.

4 Likes

Thanks to you both. The date difference function was almost good enough, but I needed to input a date difference value based on a condition. It appears that Glide does not permit calculated branches to if … then statements. But, in my case, I found that I could solve the branching issue with the date math nested within a max() function. So, problem solved. Thank you.

BTW, the “arrayfunction” info helped me solve another problem. Again, since the if … then does not permit calculated branches, I used an arrayformula with nested if…then statements embedded within the spreadsheet to solve a different problem. That calculation will not change too frequently so slow updates should not be too much of a problem.

1 Like

While you can’t do math within an IF column, you can still use the result of an IF column inside of a Math column. It’s just a matter of using several different cimputed column types together.

If you are familiar with JavaScript, then you there is also a javascript column type that let’s you do more complicated things, although dates can be tricky sometimes.

3 Likes

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