Status Chart Issue returning correct data

I am working on setting up a Status Chart to display machine status with Date Time selection. The data is in a database table. Here is the values and there meanings 0 = bypass, 1 = running, 2 = fault and 3 = Idle. I try running the query and returning just the status but it doesn't return any data. If I try returning everything in the table, it shows data but is not what I actually need. Where am I going wrong with this component.
Query 1 (Which is what I think I need to make this work but doesn't return any data on the status chart

Select Status from IngStacker 
where DateTm between '{Root Container.StartDate.date}' and '{Root Container.EndDate.date}'

Query 2 (Which returns data from each column in the table, but is the only way I can get it to display any data.

Select * from IngStacker 
where DateTm between '{Root Container.StartDate.date}' and '{Root Container.EndDate.date}'

Two things:

  • Status charts also need the timestamp in the result set, not just a status code.

  • You are using string conversion of your start and end date properties. This will likely cause grief later, as string conversions are a disaster when time zones become involved, or your backend database changes. Use a named query binding with value parameters for these. (Just say NO to curly braces in SQL.)

2 Likes

Thanks for the help. I changed my query to just give me monthly results instead of using the date time selections. I am getting data now and It is working correctly.

Select DateTm, Status from IngStacker 
where DateTm Between DATEADD(month, DATEDIFF(month, 0, getDate()), 0) and DATEADD(month, DATEDIFF(month, -1, getDate()), -1) and StackNbr = 1

Is there a way to make the mouseover text say the status when you move your mouse over each color?

Use the getTooltipText extension function:

#def getTooltipText(self, [...]):
	return selectedStatus
1 Like