Date and number formats for if-then columns

Like other topics have covered, I had a reason to change dates into numbers. But I’m having trouble changing them back into dates that an if-then column recognizes as a date.

I used luxon to change a date to the X format then tried using luxon later on to change it back to a readable date but that didn’t work.

I tried the JavaScript approach here: How to convert unix epochtime into human readable format?

The if-then column still doesn’t recognize the result as a date.

For that matter, an if-then column doesn’t consider an X date a number either! I realize this has turned into two questions. One question is: What does an if-then column require to offer comparisons by date or number instead of text?

The other question would be how to solve this use case as elegantly and simply as possible. I’d like to compare several dates that may or may not be empty, find the latest one, and use it and some related text to describe the row. The date columns are two lookup columns and another basic date column. Making an array and rolling up to find the latest date works fine, but depending on which one is the latest I would like to use different text to describe the situation. The if-then column is to check if the latest date is in the future.

Examples of the text would be
“Waiting until Aug 1, 2024” (date from basic column)
“Waiting until Spring 2025” (date from lookup)
“Waiting until Dormant pruning start date” (date from lookup)

The reason the lookup dates aren’t just hardwired basic columns is to be able to change them depending on weather and therefore update all related rows.

I think for this to happen, all columns referenced in the if-then-else logic has to be read by Glide as a date/time column. If you have even just one column considered as text in there, everything would be considered as text.

How would you compare Aug 1, 2024 to “Spring 2025”?

Thanks for clarifying the if-then column.

Those were examples of text that would go along with the date comparison. The dates being compared are actual dates, in that case pulled from a lookup column. Sorry for the confusing example - in our seasonal work, “Spring” wasn’t referencing a fixed calendar date, it’s when the snow melts and the ground dries out. I put in an estimated date for “Spring” and when that date comes around all the service items tagged to wait until “Spring” become active. Depending on weather, we might edit that date to keep those services on hold.

So if I understand you right, you have three dates with 3 columns on the same row and you want to compare them?

So this works, but you have to know which one it is matching to, to know which “text template” you want to use?

Exactly! That was why I got in the weeds trying to change the dates to numbers, creating templates joining the number dates and text, splitting the text back into dates, yadda yadda. But maybe you have a simple answer. :hand_with_index_finger_and_thumb_crossed:

Create an If-Then-Else column. If the rollup equals to column A then template A, all the way to column C, and then use that template to construct the final text.

That will work - thanks!

1 Like

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