I’m trying to create a time based chart, but the ‘group by’ field is empty and there is nothing to select from. I would expect to see the date over there. We do have a date field in the this table available. Any idea what I am doing wrong?
I am sad to hear that you have issues creating a chart, I have tried to reproduce the issue but couldn’t. Can you share with me the environment you are working on and the model of your table ?
Hello @nielswhydonate, no need to worry, I am here for that.
I have been looking into the issue, thanks for sharing the info it helped.
I found 2 causes:
As of now the only field allowed to be used for a groupby on time based charts is a “Date” field. We have already created a ticket to allow “Dateonly” defined fields to be used. This leads to the second cause.
For some reason, your ‘datetime(6)’ fields are defined as “Dateonly” fields in your .forestadmin-schema.json which shouldn’t be the case. I am setting up a mysql database to recreate the behaviour and will come back to you.
I have recreated the use case. On a mysql database, I defined datetime fields with varying precision, when update your schema via forest schema:update, you should have seen logs as following.
Basic datetime, with precision 0 as default, are handled properly and will be added to your model, however that is not the case for higher precision datetime fields. You will have to add them manually in your models. As shown here.
Since your fields are present in the schema, I think you just need to update the definition from DataTypes.DATEONLY to DataTypes.DATE, after which you simply have to update your schema then refresh your browser.