# Status Chart Issue returning correct data

**URL:** <https://forum.inductiveautomation.com/t/status-chart-issue-returning-correct-data/73417>\
**Category:** Ignition\
**Created:** [May 8, 2023, 3:45pm UTC](https://forum.inductiveautomation.com/t/status-chart-issue-returning-correct-data/73417 "2023-05-08T15:45:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [May 8, 2023, 3:45pm UTC](https://forum.inductiveautomation.com/t/status-chart-issue-returning-correct-data/73417/1 "2023-05-08T15:45:24Z")

</div>

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

```auto
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.

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

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 8, 2023, 3:49pm UTC](https://forum.inductiveautomation.com/t/status-chart-issue-returning-correct-data/73417/2 "2023-05-08T15:49:39Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [May 8, 2023, 4:33pm UTC](https://forum.inductiveautomation.com/t/status-chart-issue-returning-correct-data/73417/3 "2023-05-08T16:33:48Z")

</div>

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.

```auto
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

```

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [May 8, 2023, 4:38pm UTC](https://forum.inductiveautomation.com/t/status-chart-issue-returning-correct-data/73417/4 "2023-05-08T16:38:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [May 8, 2023, 5:02pm UTC](https://forum.inductiveautomation.com/t/status-chart-issue-returning-correct-data/73417/5 "2023-05-08T17:02:01Z")

</div>

> [@jshaffer09](#):
>
> make the mouseover text say the status

Use the getTooltipText extension function:

```auto
#def getTooltipText(self, [...]):
	return selectedStatus

```
