How to show the Trends shiftwise using Radio Button?

Is it possible to show the shiftwise charts in trends? I want to have three Radio Buttons such as ‘Shift 1’, ‘Shift 2’ and Shift 3’. If Shift 1 is selected, then the Trend has to show the values of that particular shift. Please tell me how to do this?

Yes it is possible. There are a number of ways of accomplishing that. For the Easy Chart, check out the following under “Dynamic Pens” in the Advanced configuration settings of the link below. “Chart WHERE clause” and “dynamic groups”. For the classic chart it is a matter of binding your query that populates the chart data to an expression that contains the state of your radio button. That way, a change in the selected radio button changes the database query and causes it to run again and update. This is simpler than it may sound.

inductiveautomation.com/support/ … ychart.htm

Hi, I am very much confused with this. As I said, I made three radio buttons ‘Shift 1’, ‘Shift 2’ and ‘Shift 3’. Then I made the following SQL Queries.

For the button Shift 1

select * from ht_cm1 where date_format(curdate(),’%d-%m-%Y’)=date_format(t_stamp,’%d-%m-%Y’)

and date_format(t_stamp,’%T’)<‘08:00:00’

For the button Shift 2

select * from ht_cm1 where date_format(curdate(),’%d-%m-%Y’)=date_format(t_stamp,’%d-%m-%Y’)

and date_format(t_stamp,’%T’)>‘08:00:00’ and date_format(t_stamp,’%T’)<‘16:00:00’

For the button Shift 3

select * from ht_cm1 where date_format(curdate(),’%d-%m-%Y’)=date_format(t_stamp,’%d-%m-%Y’)

and date_format(t_stamp,’%T’)>‘16:00:00’

But I am not sure about the correctness of these queries. Also, how to bind these to an Easy Chart?

I think it would be best to use the classic chart (which is the next one in the charts tab from the easy chart). It has a property called Data that you can bind to a SQL query. All you must do is make sure the timestamp column is returned as the first column in a time series chart.

You can do it with the Easy Chart as well but you have to create DB pens with dynamic where clauses (like Nathan said). For example, you can create a DB pen where you specify which column is the data column and which column is the timestamp column. Let it know which table to grab the information from which is ht_cm1 in your case. You can go to the dynamic groups tab in the customizer and add one for each shift. That will add three dynamic properties to the chart for the where clause. You can bind each one to an expression that returns:

date_format(curdate(),’%d-%m-%Y’)=date_format(t_stamp,’%d-%m-%Y’) and date_format(t_stamp,’%T’)<‘08:00:00’

for Shift 1 example. Hope this helps.