Tip: Tag history binding returning some zeros on last row

I had a problem with a tag history binding returning zeros for dates after the current time. Here’s the binding:

Here’s the result:

On the chart you can see that values have been returned for some rows but some zeros have been returned for the last value.

I found I could fix the problem by modifying the End Date expression as follows:

// Clamp the end time to "now" to prevent
// reading back zero counts for future times.
// 60000 = 1 minute refresh.

Hopefully this may help someone else.


This is just a placeholder to mark the “question” solved.