Hi,
I have this JSON as input for the datagrid.
extension:
[
{
"Id": 1.0,
"CODE": "CC RFID",
"OMSCHRIJVING": "Deense Container 2",
"GSCODE": "CC",
"ACTIEF": "Ja",
"GSONECODE": 8716532000303.0,
"VOLGORDE": 999,
"Datum": "2023-08-22T13:04:59"
},
"Id": 13.0,
"CODE": "CCKAP",
"OMSCHRIJVING": "CC Kapot",
"GSCODE": "CCK",
"GSONECODE": 0.0,
"VOLGORDE": 5,
}
]
The date is shown in the dynamic grid as a text column. Is there a default format so Datagrid will recognize it and show it as a Date or Datetine column in the grid ?
Hi @Raymond Vermeer ,
I have done something that sounds similar to what you are doing, see forge asset Data Workshop.
Look at action "buildJSONForGrid", where I am adding the metadata to the data (as @Gonçalo Martins is suggesting), so the grid can understand what each column's data type is.
It is easy there because the logic knows what entity is choosen, so I can just read the datatypes in the Entity_Attr system entity, if you let users freely write sql or something like that, you'll have to do some more effort to know the datatypes.
Dorine
Thank you Dorine!
I had a look at your forget asset.
Action "buildJSONForGrid" helped me a lot further with my issue.
Hello @Raymond Vermeer
Which version are you using? Is this an auto-generated Grid (the JSON example format will not work as is) our you'll use the column blocks (the best practice you should use)?
I hope it helps.
Cheers,GM
I see the date in the debugger in this format: 2023-10-26T01:00:00Z
When I send this to an auto-generated grid it is still a text field.
I am using version 2.10.0 of OutSystems Data Grid
Hi @Raymond Vermeer
As I mentioned before if you're trying to send a JSON generated to an auto-generated Grid without using the Arrange Data server action (which is an accelerator we provide), you won't have the metadata needed to allow the library to infer the data type (without using the column blocks the responsibility of preparing the data goes to the developer), so in that case the underlying library (Wijmo Flexgrid) will consider all the unknown information as text fields.
The problem is that use this forge component to do my queries:
https://www.outsystems.com/forge/component-overview/1305/advance-query
This component has a server action ExecuteSelectReturnJson which already returns a JSON. So I can't use the suggested ArrangeData.
Unless you create a method to build a JSON with the same information provided by the Arrange Data (receives your JSON and adds the missing metadata) you always have this problem.