Need a special offer?Find out if your project fits.
+

How do I display single date in flat grid

Answered
Chad Baudoin asked on August 30, 2019

I am trying to display my dates as a single cell in a flat grid type, but they won't show up and are broken down by Date, Month and Year when I view them in fields menu. 
 
Data Example…
```
{
confirmation_id"101851"
day"2019-01-01"
reservation_id"42858076"
}
```
Config:
```
options: {
configuratorButton: false,
drillThrough: false,
grid: {
type: 'flat',
showHeaders: true,
showFilter: true,
},
configuratorActive: false,
datePattern: 'yyyy-MM-dd',
},
slice: {
columns: [
{
uniqueName: 'day',
type: 'date string'
},
{
uniqueName: "reservation_id"
},
{
uniqueName: 'confirmation_id',
},
],
},
```
Output:

View post on imgur.com


 
Fields Menu:

View post on imgur.com


 
Intent:
I literally just want to output the dates in a flat grid. Nothing fancy at all.

3 answers

Public
Vera Didenko Vera Didenko Flexmonster August 30, 2019

Hello, Chad,

 
Thank you for your question.

 
Please specify the needed date data type:

data: [
{
"confirmation_id": {type: "string"},
"day": {type: "date string"},
"reservation_id": {type: "string"}
},
{
"confirmation_id": "101851",
"day": "2019-01-01",
"reservation_id": "42858076"
}
]

Here is a JSFiddle example for illustration: https://jsfiddle.net/flexmonster/ohL176bv/.
 
 
Let us know if this works and if you have further questions.
 
 
Best Regards,
Vera

Public
Chad Baudoin August 30, 2019

That worked. Thank you. It's unclear to me why on a flat table you need to prepend the column heading types to data vs a normal table you can do it in the measures. Can you help me understand why that is?

Public
Vera Didenko Vera Didenko Flexmonster September 2, 2019

Hello, Chad,
 
Thank you for your question.
 
In Flexmonster the default date type that is applied to date fields is date.
Other available date types for JSON data source, such as date string, datetime, year/month/day, year/quarter/month/day, can be specified in the meta-object in the JSON data as shown in our documentation: https://www.flexmonster.com/doc/managing-data-presentation-json.
 
Could you please explain more about how you specified the JSON date type otherwise?
 
We are looking forward to hearing from you.
 
Best Regards,
Vera

Please login or Register to Submit Answer