NULL values are shown as 0 in Dashboards
Recently we built a Dashboard for our IT management, where we use the worktime procedure from this link: https://cireson.com/blog/sql-getting-working-hours-between-two-dates/
In this dashboard we have a table widget, where we calculate the time between createddate and responsedate,assigneddate, resolveddate. It works really well but as we do not want to show decimal values, we convert the values to integer via e.g.CAST((dbo.fn_Get_Total_Working_Hours(Created,FirstAssignedDate)) as int)
Now inside the widget NULL values are shown as 0 and are not empty, which is not optimal as this might indicate that e.g. the response date has been under an hour when in reality it is NULL. In this widget we also show a column which is an integer by default (without cast), and this column is empty when a NULL value is returned. When I run the query in the SQL mgmt studio, all NULL values are returned correct, also the ones which have been converted to INT like in the code above.
Right now we just return 1 if a returned value is between 0 and 1 and only return 0 if the value is NULL, but this is not what we want tbh.
Is this a bug in the portal? Or is this works as designed, that NULL values are shown as 0 when the value has been converted to int. Especially as not converted integer values are shown as empty in the widget as it should be.
Answers
Hi Simon,
How does the data come back from the API? With null or 0?
I wonder if this is an API issue or a widget issue?
Geoff
@Geoff_Ross in the console it is shown as 0, real NULL values (without being converted to INT) are shown as empty values. But shouldn't it be empty as well? Especially when the query returns NULL when executed inside the SQL Mgmt Studio.
I think we need to open a bug. I'll get that done.
thanks for that :)