Fill Date component via form data key when query runs

  • Goal: autopopulate form value with date from database when a query runs

  • Steps: create mysql table with a DATE column and a VARCHAR column. Create a form in retool, attach it to the query which pulls data from this table, and fill it with the two columns from the table you created. The 'Form Data Key' for both components will correspond to the two columns you created.

  • Details: when the query runs, the form does not fill in the date value. It properly fills the varchar value though.

I tried with both a DATE and TIMESTAMP column with both date and datetime components within retool and neither works.

1 Like

hi @retool_user how about JSON schema form with type: "date"?

in the above, i queried two columns: varchar and timestamp. then, i passed the objects to the json schema form. i used "Generate schema automatically from database" options when creating the component, and removed extra columns except for two, to fit your example.

you can play around with specific date and time formatting:
https://rjsf-team.github.io/react-jsonschema-form/

Interesting solution @trz-justin-dev, I need to get familiar with JSON schema forms.

@retool_user It is quite strange that you're not getting the date appearing. I have applied the the same setting you have and it always works smoothly.

Have you tried referencing one date using a regular date component to see if the issue lies with the form or the data?

2 Likes