Despite the COVID-19 outbreak, our team continues operating at full speed. We are always here to support and answer all your questions.

Feel free to reach out by filling this quick form.

Fill the form
Get Free Trial

Custom data source API how to handle 'null' date value.

Answered
Parmod asked on October 6, 2020

Hi,

{
"fields": [
{
"uniqueName": "Date",
"type": "date",
"caption": "Date"
},
{
"uniqueName": "Custom Month",
"type": "string",
"caption": "Custom Month"
},
{
"uniqueName": "Weight",
"type": "number",
"caption": "Weight"
}
]
}

// member response
{
"members": [
{
"value": 1596393000000
},
{
"value": 253402194600000
},
{
"value": 1600453800000
},
{
"value": 1600540200000
},
{
"value": 1600713000000
},
{
"value": 1600799400000
},
{
"value": 1600885800000
},
{
"value": 1578249000000
},
{
"value": 1594233000000
},
{
"value": 1577212200000
},
{
"value": 1600281000000
},
{
"value": 1600626600000
},
{
"value": 1577644200000
},
{
"value": 1577903400000
},
{
"value": 1594146600000
},
{
"value": 1601058600000
},
{
"value": "NULL VALUE"
}
],
"sorted": true,
"page": 0,
"pageTotal": 1
}

// select request for the pivot table
{
"aggs": [
{
"keys": {
"Date": 1600713000000
},
"values": {
"Weight": {
"sum": ""
}
}
},
{
"keys": {
"Date": 1600799400000
},
"values": {
"Weight": {
"sum": 142
}
}
},
{
"keys": {
"Date": 1600626600000
},
"values": {
"Weight": {
"sum": ""
}
}
},
{
"keys": {
"Date": 1594146600000
},
"values": {
"Weight": {
"sum": ""
}
}
},
{
"keys": {
"Date": 1600540200000
},
"values": {
"Weight": {
"sum": 1100
}
}
},
{
"keys": {
"Date": 1601058600000
},
"values": {
"Weight": {
"sum": ""
}
}
},
{
"keys": {
"Date": 253402194600000
},
"values": {
"Weight": {
"sum": 18136.85000038147
}
}
},
{
"keys": {
"Date": 1594233000000
},
"values": {
"Weight": {
"sum": ""
}
}
},
{
"keys": {
"Date": 1577903400000
},
"values": {
"Weight": {
"sum": ""
}
}
},
{
"keys": {
"Date": 1600885800000
},
"values": {
"Weight": {
"sum": ""
}
}
},
{
"keys": {
"Date": 1577212200000
},
"values": {
"Weight": {
"sum": ""
}
}
},
{
"keys": {
"Date": 1600281000000
},
"values": {
"Weight": {
"sum": ""
}
}
},
{
"values": {
"Weight": {
"sum": 866829.8590026698
}
}
},
{
"keys": {
"Date": 1577644200000
},
"values": {
"Weight": {
"sum": ""
}
}
},
{
"keys": {
"Date": 1600453800000
},
"values": {
"Weight": {
"sum": ""
}
}
},
{
"keys": {
"Date": 1596393000000
},
"values": {
"Weight": {
"sum": 847451.0090022883
}
}
},
{
"keys": {
"Date": "NULL VALUE"
},
"values": {
"Weight": {
"sum": "84.2245"
}
}
}
],
"sorted": false,
"page": 0,
"pageTotal": 1
}

For some record in DB, I’m having ‘date’ values as null.
How to display null values as ‘NULL VALUE’ in filters and ‘pivot table’.

5 answers

Public
Milena Pechura Milena Pechura Flexmonster October 7, 2020

Hello, Parmod,
 
Thank you for posting to our forum.
 
To achieve the described component behavior, we kindly recommend specifying grid.dateInvalidCaption as "NULL VALUE" in the localization property of the global object.
We have prepared an example for illustration: https://jsfiddle.net/flexmonster/6v42hfcr/.
 
Please let us know if it works for you and if any additional questions arise.
 
Best regards,
Milena

Public
Parmod October 8, 2020

Hi Milena,
Is there any other way to do this. If the value is other than "NULL VALUE" , I have to show the "Invalid Date" caption instead of "NULL VALUE".
 

Public
Milena Pechura Milena Pechura Flexmonster October 12, 2020

Hi, Parmod,
 
Thank you for your question.
 
Currently, our component provides the following logic: if the date value is not in the date format, the value is treated as invalid.
Please let us know how critical the option to show null and invalid values as different is for you.
 
Looking forward to your response.
 
Best regards,
Milena

Public
Parmod October 12, 2020

Hi Milena,

It is import for us, Because Null value is a valid data in database. If we show i.e 3343-2343-234 as "NULL VALUE" that doesn’t make any sense on UI, because it is actually a "Invalid Date" value. But "NULL" value is a valid database value.
If we talk about member-request then in "filter" user can select "NULL VALUE" for date fields which values is 'null' on database.

Can we have something like this:
grid.dateNullCaption as "Custom localize lable"

Public
Milena Pechura Milena Pechura Flexmonster October 13, 2020

Hello, Parmod,
 
Thank you for your answer.
 
The details about the desired component functionality have been passed to our dev team. We are going to provide you with the most relevant solution ETA Nov 16.
 
Please contact us in case other questions arise.
 
Kind regards,
Milena

Please login or Register to Submit Answer