Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Date Difference
djspooch
<p>Good Day!</p><p> </p><p>I'm just new in using Birt Report and would like to seek for some help form you guys. Im trying to include a column on my birt report (Total Hours Spent). I was able to show the difference of 2 dates but in hours with the querry below:</p><p>SELECT DATEDIFF(HOUR,wo.reportdate,wo.statusdate) ) TotalHourSpent" ->> this will show how many hours</p><p> </p><p>But what i want is to have this kind of format as a result "[color=#ff0000;]<strong>1:12:32:44</strong>[/color]" on my Total Hours Column, so i use the querry below:</p><p> </p><p>" SELECT CONVERT(VARCHAR(15),Datediff(SECOND,wo.reportdate,wo.statusdate)/(60*60*24)) + ':' "<br />
+" +CONVERT(VARCHAR(20),DateAdd(SECOND,Datediff(SECOND,wo.reportdate,wo.statusdate)%(60*60*24),0),108) TotalHourSpent "</p><p> </p><p>Now the problem is, on the 2nd querry, its not showing any records on the preview option, but its working fine in SQL. But if im using the 1st querry it is working just fine on Birt</p><p> </p><p>How you can help me with my concern</p><p> </p><p>Thanks</p>
Find more posts tagged with
Comments
ahsiang
Why not create a calculated field within the data set rather than via the SQL?
djspooch
<p>thanks for the respond ahsiang, can you be more specific.</p><p> </p><p>Thanks</p>
djspooch
<p>are you pertaining on the expression field of the calculated field?</p>
ahsiang
<p>I am referring to the Computed Column within the data set. Look at the attached image.</p>
djspooch
<p>im sorry ashiang but ic ouldnt see the attached image..</p>
ahsiang
<p>Please take a look here, <a data-ipb='nomediaparse' href='
http://www.linuxtopia.org/online_books/eclipse_documentation/eclipse_birt_report_guide/topic/org.eclipse.birt.doc/birt/eclipse_birt_report_retrieving-data.3.6.html'>http://www.linuxtopia.org/online_books/eclipse_documentation/eclipse_birt_report_guide/topic/org.eclipse.birt.doc/birt/eclipse_birt_report_retrieving-data.3.6.html</a></p>
;
magic_bern
<p>Hi <span><a data-ipb='nomediaparse' class="" href='
http://www.birt-exchange.org/forum/index.php?/user/59758-djspooch/'
title=""><span>djspooch</span></a></span>, I think Ahsiang is right and using a computed data item may be your best bet. to add a text or data item, you can simply right-click on the cell you want it, choose insert new and choose either text item or data item.</p><p>play with those and u can see some birt datespan function that may give u what you are after</p>