Home » Archived » BIRT » Using Array data in graphs(how do I deconstuct array data in a single column for use in graph)
Using Array data in graphs [message #684057] |
Tue, 14 June 2011 23: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
|
|
|
Re: Using Array data in graphs [message #684382 is a reply to message #684057] |
Wed, 15 June 2011 14:06 |
|
Chris,
If the column is a string you could always add a computed column. Set
its type to Java Object and enter this expression:
dataSetRow["longcol"].split(",");
Then you get at values like:
dataSetRow["myjavaobjectcolumn"][12]
Which should also work with aggregation elements.
Jason
On 6/14/2011 7:28 PM, Chris wrote:
> 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
|
|
| |
Goto Forum:
Current Time: Thu Sep 19 05:41:21 GMT 2024
Powered by FUDForum. Page generated in 0.04176 seconds
|