| Using Array data in graphs [message #684057] |
Tue, 14 June 2011 19:28  |
Chris Messages: 47 Registered: September 2010 |
Member |
|
|
Hi,
I am trying to graph the number of users online for each of the 24 hours in a day. I have the login time and the logout time, and have created a function which returns an array of 24 numbers which represent the 24 hours in a day, and has a value of 1 if the user was online during the hour and 0 otherwise ie for user online from 10am to 2pm this is the array values (0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0).
When included in the SQL query the above array becomes a single column.
Can I use this data in this format or not? I need to get statistics like the total number online for each hour (array element) ie sum(arrayhour[3]) and then display the results graphically.
I need to keep the hour data with the rest of the columns so that I can analyse login times by branch,dept,total/user/mth etc.
I have a very clutzy solution which involves 24 functions one for each hour, which are each called once in the query, and so return 24 columns. However if I can use the array it would be better.
Thanks for your help
Chris
|
|
|