It is currently Sat Jul 26, 2014 5:10 am




Post new topic Reply to topic  [ 4 posts ] 
 How to show the Trends shiftwise using Radio Button? 
Author Message
Cadet
Cadet

Joined: Thu Aug 25, 2011 11:22 pm
Posts: 9
Post 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?


Wed Apr 25, 2012 11:29 pm
Profile
Moderator
Moderator

Joined: Thu Mar 30, 2006 10:08 pm
Posts: 1188
Post Re: How to show the Trends shiftwise using Radio Button?
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.

http://inductiveautomation.com/support/ ... ychart.htm

_________________
Nathan Boeger, CISSP-ISSAP, CCNP Voice, VCP
Not Another Industrial Blog - My SCADA software blog
"Design Simplicity Cures Engineered Complexity"


Thu Apr 26, 2012 1:13 am
Profile WWW
Cadet
Cadet

Joined: Thu Aug 25, 2011 11:22 pm
Posts: 9
Post Re: How to show the Trends shiftwise using Radio Button?
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?


Wed May 09, 2012 2:12 am
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: How to show the Trends shiftwise using Radio Button?
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.

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Wed May 09, 2012 7:07 am
Profile WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: