Creating Last Incident With Data Sets


#1

Im trying to have a layout which just displays the number of days since the last incident. For example, if today is 01/31/19 and the last incident was on 01/28/31. It should show 3.

I have partially followed a tutorial but the format would be incorrect to what I want. I have begin creating a DataSet under Library. I named it Last Incident.
I created two columns
A. dtLastIncident with the Datatype-Date and Column Type -Value and the order for that is 1.
B. hSinceLast with the DataType-Number and Column Type-Formula and the order for that is 2. The Formula inputed in that is DATEDIFF(NOW(),dtLastIncident)
THen I created a row and put Jan 28 2019 as the last incident but it shows up -301. What did I do wrong?

It should show 3. SInce the date is Jan 31, 2019


#2

Try DATEDIFF(CURDATE(), dtLastIncident)


#3

When I do Jan 28, it is now positive. But it shows 30 in the hSinceLast field. Did I do the other steps right?


#4

Also I see that there is another field on the right with a drop down. But it is blank and I can’t choose anything.


#5

I get a date picker for selecting the date and its displayed in format 2019-01-28 09:00


#6

Strange, dont know what Im doing wrong. Even When I choose the date it only shows January. In other words if I choose Jan 28 2019, it then just shows Jan in the field and the second field I just cant choose nothing.


#7

What are your date format settings in administration-settings-regional. I have Y-m-d H:i which corresponds to the format I have in the date picker.


#8

That was the problem, in experimenting with different ways in trying to get it to work, I change the format to M. Now I changed it to what you have and it works.


#9

Now, that I got that working. I created a ticker in the layout and used that dataset. I get the whole date and not just the number. How do I fix that?

Nevermind