Rollup function cast datetime to date (bug?)

Are you using our SaaS platform (Baserow.io) or self-hosting Baserow?

SaaS

What are the exact steps to reproduce this issue?

I have 2 tables:

  • Instance : has a link to Event table, and a field called Date Sort which is a datetime (e.g. 2024-01-22 14:00)
  • Event : has a field called Latest Date Sort which is a Rollup, with link = Instances, rolled up field = Date Sort, and rollup function = max.

The values in the Latest Date Sort field are not datetimes as expected, but the rounded down date (e.g. 2024-01-22)

Am I missing anything or is this a bug?

Replying to self:
while this is being an issue with the Rollup field type, I can work around it using a formula instead:
max(lookup('Instances', 'Date Sort'))
After creating it, I can edit the field again and add the display of time / timezone etc, and the value is indeed not rounded down to a date.

This is not the case when using the Rollup field directly (the only option is to add a description, and the value is rounded down to a date).

1 Like

Hi @Yam 1, have you checked here to include the time:

What I meant here, is that these options did not appear when I was using the rollup column type directly. The behavior seems to be depending on context since your own example does not have this issue. I’ve been wondering if it’s not related to the null coercion mechanism… Sometimes I have functions return values that appear as scalars and sometimes as 1 element arrays - with a border around the value, apparently as a way to deal with possible null return values, and in that case a lot of things don’t work nicely when using lookup or rollup on the result.
E.g. here:


the left column (a calculation on a date), I can access options to display time, the right one (a rollup), I cannot if I use a rollup field, and I can if I use a rollup function directly, as explained in my original message.

Got you, @Yam! I’ll check with the team what it depends on and if we have this documented. :slightly_smiling_face:

Hey @Yam, I’ve checked with the team. In short, you’ll get results as element arrays—with a border around the value—when there can be multiple values. If you need more details, I’ll ask our Baserow Specialist to explain it thoroughly. Just let me know :slightly_smiling_face:

Thanks for your reply. I think it makes sense. I’ve worked around it by “casting” such 1-element arrays with max() or join(..., "") depending on whether the element is numeric or not.