Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Time diffrence different rows
sgiesbers
Hello,
I'm not sure if this is the correct forum, but ill give it a try!
This is the response of a query:
[PROCES] [ID] [DATE] [STATUS]
Proces A 925808352 19-07-2010 13:51:31 Started
Proces A 925808352 19-07-2010 13:51:35 succesful
Proces B 925808353 19-07-2010 13:51:36 Started
Proces B 925808353 19-07-2010 13:51:37 succesful
Proces A 925808354 19-07-2010 13:51:39 Started
Proces A 925808354 19-07-2010 13:51:45 succesful
Is it possible to calcualte the time diff (in sec) between de unique id's (started/succesful)?
Maybe with a computed column?
Thanks in advance,
Sjoerd
Find more posts tagged with
Comments
mwilliams
Hi Sjoerd,
If your ID's all have a started and successful rows in order as in the post above, you could easily keep a temp variable where you store the "started" value and then use that variable to compute the difference in your computed column. If there isn't always a started and successful value, you could create persistent global variables with the name of the PGV being the ID so that you can recall the started value with the ID when you run into a successful row with the same ID.
Hope this helps. Let me know if you have any questions.
csasaki
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="66713" data-time="1280150749" data-date="26 July 2010 - 06:25 AM"><p>
Hi Sjoerd,<br />
<br />
If your ID's all have a started and successful rows in order as in the post above, you could easily keep a temp variable where you store the "started" value and then use that variable to compute the difference in your computed column. If there isn't always a started and successful value, you could create persistent global variables with the name of the PGV being the ID so that you can recall the started value with the ID when you run into a successful row with the same ID.<br />
<br />
Hope this helps. Let me know if you have any questions.<br /></p></blockquote>
<br />
Hi Mr. Williams,<br />
<br />
i'm working with ibm RQM and i made some birt reports on it (the only birt reports i ever made).<br />
I'm looking for the exact thing as the user above but i couldnt understand the PGV (persistant global varialbe) stuff. I have a table like this :<br />
<br />
WI---New State ---- Time Stamp<br />
A ---New
18/02/2011 18:00<br />
A----Resolved
20/02/2011 4:00<br />
B----Working
15/02/2011 3:00<br />
B---Closed
18/03/2011 4:00<br />
<br />
I need the difference between some states but for the same WI(id). <br />
How could i achived this?
mwilliams
Is there always just 2 rows with the same WI? So, you'd always just want the difference between the two rows with the same WI? Or what is the requirement? The PGV idea was just to store the first value in a PGV named by the ID row so that the first value would easily be recalled by the ID of the second value. If just trying to find the difference between two consecutive rows all the time, you could just keep track of the last row's value in a regular javascript variable. Let me know.
csasaki
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78061" data-time="1307396531" data-date="06 June 2011 - 02:42 PM"><p>
Is there always just 2 rows with the same WI? So, you'd always just want the difference between the two rows with the same WI? Or what is the requirement? The PGV idea was just to store the first value in a PGV named by the ID row so that the first value would easily be recalled by the ID of the second value. If just trying to find the difference between two consecutive rows all the time, you could just keep track of the last row's value in a regular javascript variable. Let me know.<br /></p></blockquote>
<br />
Hi<br />
<br />
No, sorry for the bad example. Not necessarily it only have 2 rows. It could have 2,3,4, ... etc.<br />
A ---New
18/02/2011 18:00<br />
A----Resolved
20/02/2011 4:00<br />
B----Working
15/02/2011 3:00<br />
B---Closed
18/03/2011 4:0<br />
B---Reopened
20/03/2011 4:00<br />
..<br />
....
mwilliams
You could probably group by WI, sort your groups by the date, then use aggregations to grab the first and last values of each group to do your computation. That might be the best way.
csasaki
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78067" data-time="1307398930" data-date="06 June 2011 - 03:22 PM"><p>
You could probably group by WI, sort your groups by the date, then use aggregations to grab the first and last values of each group to do your computation. That might be the best way.<br /></p></blockquote>
<br />
Well what i need is something like this :<br />
<br />
A ---New
18/02/2011 18:00 <br />
A----Resolved
20/02/2011 4:00 Difference between New and resolved<br />
<br />
B----Working
15/02/2011 3:00 <br />
B---Closed
18/03/2011 4:0 Difference between working and closed<br />
B---Reopened
20/03/2011 4:00 Difference between closed and reopened<br />
<br />
C----Start Working
15/02/2011 3:00 <br />
C---Suspend
18/03/2011 4:0---Difference between(Start Working and Suspend)<br />
C----Working
15/02/2011 3:00---(Difference between suspend and working)<br />
C---Closed
18/03/2011 4:0---- difference between working closed<br />
C---Reopened
20/03/2011 4:00--- difference between...<br />
<br />
As you can see need the different from the above WI but the first dosent have any time difference because it is the first.
mwilliams
You should be able to group your table by WI, set a variable in your initialize to "", and save the last date value in this variable, then reset this variable in the WI group footer. Then you'll be able to use a dynamic textbox to figure the difference between the current value and the last value. If you're on the first row of the WI group, the value of your "last value" variable would be "", so you could check for that and output nothing if this is the case. Hope this makes sense. Let me know if you need an example.
csasaki
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78114" data-time="1307464927" data-date="07 June 2011 - 09:42 AM"><p>
You should be able to group your table by WI, set a variable in your initialize to "", and save the last date value in this variable, then reset this variable in the WI group footer. Then you'll be able to use a dynamic textbox to figure the difference between the current value and the last value. If you're on the first row of the WI group, the value of your "last value" variable would be "", so you could check for that and output nothing if this is the case. Hope this makes sense. Let me know if you need an example.<br /></p></blockquote>
<br />
Hi<br />
<br />
I'm kind of understand but dont know how to make it real. I'm really kind of newbee in this BIRT World. I got here through Rational reports because i needed them. <br />
<br />
First, how do you initialize a variable? (as long as i have done was creating a variable on the script tab and "On Create" put something like Fecha = row["TIME_ID.TIMESTAMP"];)<br />
<br />
Please can you handle me an example?
mwilliams
Here is an example made in BIRT 2.6.1. I used your above data in a CSV dataSource. For you to run this, you'll need to change the location of the CSV file to where you save it, in the dataSource editor. Let me know if you have questions.
csasaki
Hi
I could not open your file, it said that the report file versioin 3.2.22 is invalid for it is greater than the lastest support one.
I am using Rational Team Concert with the birt plug in.
Well I create a variable ( found how!
) in :
Initialize
var temp = 0;
Then in the script row :
On Create
temp = row["TIME_ID.TIMESTAMP"];
Then i put a dynamic text that showed :
temp - row["TIME_ID.TIMESTAMP"];
but the result is "0" because temp is the same value of therow["TIME_ID.TIMESTAMP"];
How can i put the temp to be the last value and not the actual value.
mwilliams
Try changing the version info in the xml source to match that of your version, then open it. If it doesn't work, let me know. I'll create the same report in your version. You'll just have to let me know what version that is.
csasaki
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78199" data-time="1307582006" data-date="08 June 2011 - 06:13 PM"><p>
Try changing the version info in the xml source to match that of your version, then open it. If it doesn't work, let me know. I'll create the same report in your version. You'll just have to let me know what version that is.<br /></p></blockquote>
<br />
Hi, i tried to change the version in the xml :<br />
<br />
<report xmlns="<a class='bbc_url' href='
http://www.eclipse.org/birt/2005/design'>http://www.eclipse.org/birt/2005/design"</a>
; version="3.2.17" id="1"><br />
<br />
But it does not let me save!.
mwilliams
Here's one made in 2.3.1. Let me know if you have questions.
csasaki
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78242" data-time="1307630233" data-date="09 June 2011 - 07:37 AM"><p>
Here's one made in 2.3.1. Let me know if you have questions.<br /></p></blockquote>
<br />
Mr. Williams !<br />
Thanks a Lot
! You are a really a true guru
<br />
If i want to learn from the beginning BIRT process do I have to follow the tutorials here? or they are more advance level?
mwilliams
There are getting started guides in the wiki on this site. There are also several books out there to help with getting started with BIRT. The most in-depth are probably the Eclipse series ones, but there are a couple others that are more general getting started books. Let me know if you have trouble finding the books, I can point you to them if you need me to.
csasaki
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78259" data-time="1307639286" data-date="09 June 2011 - 10:08 AM"><p>
There are getting started guides in the wiki on this site. There are also several books out there to help with getting started with BIRT. The most in-depth are probably the Eclipse series ones, but there are a couple others that are more general getting started books. Let me know if you have trouble finding the books, I can point you to them if you need me to.
<br /></p></blockquote>
<br />
Hi Mr. Williams<br />
<br />
I'm working with the report and i'm having this results :<br />
Unassigned New <br />
<br />
E. Inicial - E. Final- Action TimeStamp- Tiempo de transici?n <br />
<br />
Unassigned -New -Aug 4, 2010 3:11 PM <br />
New - New-Aug 4, 2010 3:13 PM - 0 dia(s), 0 horas(s) y 3 minutos(s). <br />
New - Assigned- Aug 5, 2010 12:41 PM - 0 dia(s), 21 horas(s) y 28 minutos(s). <br />
Assigned - In Progress- Aug 9, 2010 11:05 AM - 3 dia(s), 22 horas(s) y 23 minutos(s). <br />
Resolved - Resolved- Aug 9, 2010 12:38 PM - 0 dia(s), 1 horas(s) y 34 minutos(s). <br />
<br />
What i need now is instead of showing every initial state and final state only a few like only "new-Assigned" and "Assigned- In Progress" also "In Progress Design", "Design-Temp" , "Temp,Ready" so the results will look like this for example<br />
<br />
New - Assigned- Aug 5, 2010 12:41 PM <br />
Assigned - In Progress- Aug 9, 2010 11:05 AM - (Time between both rows)<br />
<br />
and the same for the other combinations.<br />
I tried to filter like the values with this :<br />
<br />
Final Stae
"In Progress" || "Assigned") <br />
Inital stae ("New" || "In Progress")<br />
<br />
is this the right way to filter 2 or more results?
csasaki
Well i will respond to myself.
I select the "In" operator in the filters and then put the values i wanted to show.
mwilliams
Glad you found a solution! Let us know whenever you have questions!
m29
If I need to put in a row the time difference between current row and the next, what should I do?(for the first row I need the values from the first and the second row). Something like row.next()["TimeStamp"] - row["TimeStamp"]
thuston
<blockquote class='ipsBlockquote' data-author="'m29'" data-cid="80447" data-time="1311327999" data-date="22 July 2011 - 02:46 AM"><p>
If I need to put in a row the time difference between current row and the next, what should I do?(for the first row I need the values from the first and the second row). Something like row.next()["TimeStamp"] - row["TimeStamp"]<br /></p></blockquote>
Make a new thread. But you can't read ahead, you can only remember what you've already read.
mwilliams
There are ways you can get this output. Like thuston said, please start a new thread for this, and one of us will help you out.
m29
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="80460" data-time="1311343008" data-date="22 July 2011 - 06:56 AM"><p>
There are ways you can get this output. Like thuston said, please start a new thread for this, and one of us will help you out.<br /></p></blockquote>
sgotsch
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78175" data-time="1307550018" data-date="08 June 2011 - 09:20 AM"><p>
Here is an example made in BIRT 2.6.1. I used your above data in a CSV dataSource. For you to run this, you'll need to change the location of the CSV file to where you save it, in the dataSource editor. Let me know if you have questions.<br /></p></blockquote>
<br />
Thanks man, big help!<br />
Steve
mwilliams
You're welcome! Let us know whenever you have questions!
AndyRajput
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="84767" data-time="1320183551" data-date="01 November 2011 - 02:39 PM"><p>
You're welcome! Let us know whenever you have questions!
<br /></p></blockquote>
<br />
Hi William,<br />
<br />
I am trying to calculate the Timestamp Difference between two Rows, and populate the result in the next column<br />
<br />
For example :<br />
<strong class='bbc'>State</strong> <strong class='bbc'>Timestamp</strong> <strong class='bbc'>Difference</strong><br />
<br />
State_1 18/05/2013 18:00 1 hour<br />
<br />
State_2 18/05/2013 19.00<br />
<br />
<br />
How can i do this? I am newbie so i don't have much knowledge on BIRT reports.<br />
<br />
Regards,<br />
Anurag
mwilliams
So, you want the difference value for a particular row to be the difference between the CURRENT row and the NEXT row? Not display the value on a row for the difference between the PAST row and the CURRENT row? Is this correct? Let me know.
If the first, there are a few different ways you could go about it. One would be to create duplicate tables and hide the first one. You'd do your calculations in the first and then use those computations to fill out the difference field in the second table. Another possibility would be to have a text element bound to your dataSet prior to your table and do the computations in your onFetch script of your dataSet, then use these values to fill the column in your table. There's also a possibility of using the data engine api to run your data prior to creating the design so you could avoid the extra element in the design, though, this would require more script. There are probably other options as well.