Date value from SQL not showing in date fields in form

  • Goal:
    I am trying to show a database record in an edit form. I have a query that pulls the entire record from the database and is populating almost all the fields of this form.
    The fields that don't show anything are the date fields. if I switch them to text they display the ISO value of the date returned from the query, but that's not what I want.

  • Steps:
    I have tried changing the format, replacing the default value, checking the form data key, creating a new field from scratch, removing the place holder, removing the time from the source, clearing and resetting the form on modal close, etc.

  • Details:
    this is a standard datetime field in SQL Server.
    and the form field is a standard datetime field as well.

  • Screenshots:


    2024-08-21_14-22-51

1 Like

Any chance you can share the whole dataForm1Project.data object? It looks like the CreationDate is a text string in an array?

every value is in an array.
image

when I break the date value out of the array
image

it still doesn't show.
image

I am just curious why only the dates aren't showing, when I have Form Data Key setup.
every other field in the form shows fine, without me having to define default values.
image

Hi @Shegs, it looks like the component is evaluating the data as a string and not a data object. Let's try setting the default value to:
{{ moment.utc(dataForm1Project.data.CreationDate[0])}}

still nothing:
image

Interesting! Do you mind sharing the whole object that is the value of dataForm1Project.data?

Here is my setup:

for some reason, your select statement is putting everything inside a data array, for me, each field is an array.

Try formatting the output under the 'Transform results' setting for the query:

Screenshot 2024-09-04 at 10.15.30 AM

That worked.
And when I switched the form source to the 0 index of that data array, all the fields populated, including the date ones.

Thanks

1 Like

You are welcome! :slightly_smiling_face: