Jump to content
We've recently updated our Privacy Statement, available here ×

rajuchacha007

Members
  • Posts

    67
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Downloads

Posts posted by rajuchacha007

  1. I noticed this. I kept on searching to find a way to resolve (I thought i am doing something wrong in sql syntax). I should have pointed out it earlier though. I was working on some other issues as well. Got your point. Sorry for this long post. It's been to long. Thank you very much for the help.
  2. Slow,

    This is what I have achieved so far.

    Database: I am selecting 2 dates from database. starttime and endtime.

    Variables: I have defined following variables.

    name                     class                           expression

    startdate                java.util.date              $F{starttime}   

    endDate                java.util.date              $F{endime}

    starttimems         java.lang.long             new Long((new DateTime($V{startDate})).millisOfSecond().getMillis())

    endtimems         java.lang.long              new Long((new DateTime($V{endDate})).millisOfSecond().getMillis())

    joda_period        java.lang.Object         

    I took a textfield(java.util.String) and pasted following expression

    Now taking a textfield and putting expression ($V{endtimems}-$V{starttimems}) i am getting milliseconds. I am attaching the report.

    Apart from those I tried,

    ($V{endtimems}-$V{starttimems}).getHours()+"hh "+($V{endtimems}-$V{starttimems}).getMinutes()+"mm "+($V{endtimems}-$V{starttimems}).getSeconds()+"ss "+($V{endtimems}-$V{starttimems}).getMillis()+"ms "

     

    I also tried,

    " "+(new Period($V{starttimems}.getTime(),$V{endtimems}.getTime())).getHours()+"hh"+
    " "+(new Period($V{
    starttimems}.getTime(),$V{endtimems}.getTime())).getMinutes()+"mm"+
    " "+(new Period($V{
    starttimems}.getTime(),$V{endtimems}.getTime())).getSeconds()+"ss"+
    " "+(new Period($V{
    starttimems}.getTime(),$V{endtimems}.getTime())).getMillis()+"ms"

    I also tried

    $V{joda_period}.getHours()+"hh "+$V{joda_period}+"mm "+$V{joda_period}+"ss "+$V{joda_period}+"ms ".

    Now I tried

    (new SimpleDateFormat("HH 'hh', mm 'mm,' ss 'ss',SS 'ms'")).format(new Date(($V{endtimems}-$V{starttimems}).longValue()-3600000)) without using joda. I am getting following result. I am attaching 2 pdf files here.

    Also, how to view milliseconds  in mysql. I have been trying to get milliseconds column but not successful yet. Not sure how you did print start_time: 23/08/2010 10:57:00:592. Please suggest. I know you have used oracle DB. I am afraid that i am going at wrong direction as i am using mysql. While searcing I found that MySQL doesn't support milliseconds in any of the time / date columns, or return it in NOW().

    Thank you for your help.

    Best regards.


     




    Post Edited by rajuchacha007 at 08/31/2010 09:32
  3. hello. thanks for the reply. I did everything as per steps. I have defined 2 variables for startDate and endDate of the type java.util.Date(). For startDate in the variable expression i am writing $F{starttime} instead of new date() as $F{starttime} is my actual start time from the database.$F{starttime} is of type java.sql.timestamp() though. I have same thing for endDate(java.util.Date)variable expression $F{endtime}(from database of type java.sql.timestamp. Is this the thing where in i am going wrong? I mean while defining variable expression? Also I got here a variable called $V{jodaPeriod}(of type long) and tried both expression with the change as per my names. Instead of now and start_time I am using my corresponding variables. I went through these articles as well. I tried it by changing its expression class (from java.util.Date to java.sql.TimeStamp and vice versa). It is really easy to use but i am bungling some where. Thank you.

     

    Best regards.

  4. rajuchacha007
    Wrote:

    Time_diff uses the joda Period to create a time difference and print only the details you prefer (hours, minutes, seconds, milliseconds...)
    I used JodaTime as you asked, but I think the report can be done without it, simply using  java Date, long etc.
    teps partially now. thanks :)

    will you please guide how does it show in the format like 0hh 0mm 0ss 15ms. Right now i am getting milliseconds difference. Not able to convert them in 0hh 0mm 0ss 15ms in this format. Thank you in advance. I have imported joda class.

     

    BEst  regards



    Post Edited by rajuchacha007 at 08/27/2010 12:17
  5. Experts,

     

    I am using master-subreport functionality for the report. Later I am execute both through java code. Until now, I thought there is no issue. Problem occured when I tested my code on other macine. It didn't generated the report and displayed an error message that it could not find the subreport's expression. When I checked it, I found that SUBREPORT_DIR's default value expression was set to D:\\databaseReports\\. It was set when I used to test the report on my machine. Now problem is even though I set this default value expression to default, it doesn't display the reports. How could I change this expression to relative path other than this hard coded path"D:\\databaseReports"? I am not able to execute those reports when I remove this expression. Please suggest the ideas/advices. Thank you in advance.

     

    Best regards.

  6. I got your point. Thank you for the explanation. Just wanted to know, how did you bring start_time (ms)in the report? Did you define a new variable here? I can see the difference between start_time (ms) and now(ms) there. I think I should subtract my report's dates in this way so that I can get every element including milliseconds. i am experimenting for my result set so that there should be less coding in the actual java programming while executing the report. Thanks for the time to time suggestions.
  7. "Hello, i understand how to fill the JasperReport with data when i put the sql into the iReport. But how can i fill the JasperReport with Data from Java code? Can somebody please give me an example greets"

    You need to pass key:value pair via a hashmap:

    HashMap hm = new HashMap();
            hm.put("Key", "Value");

    illustrated below in a a sample code which might not work on your machine.

    Best regards

    Code:


    Post Edited by rajuchacha007 at 08/20/2010 12:20
  8. First of all thank you for the present. :D :). It certainly works for the milliseconds. I am looking for difference between two dates including difference in milliseconds. Following is my output at the moment.

     

    ID StepName StartTime EndTime RunTime Status

    3 Process1 2010-08-09 02:08:00 AM 2010-08-09 02:08:01 AM 00:00:01 Success

    4 Process2 2010-08-09 02:08:01 AM 2010-08-09 02:15:00 AM 00:06:59 Success

     

    My concern is to display milliseconds difference if any. That is why I tried to use Timedff(above query) etc. It didn't work. I read about joda time and asked about it if it is feasible. I tried to use your solution. I think it is not working. I really appreciate your help/solution. I think i should try while executing the report in java code. What do you recon? I mean there must be some mechanism to import these fields in java code with modifications? Am I thinking rather guessing correct? Thank you very much.

     

    Best regards.

  9. Hello Experts

     

    In order to display milliseconds, I tried to fire SQL query using

    TIME_FORMAT(TIMEDIFF(process1.end_datetime, process1.start_datetime),'%H:%i:%S%f') as exec_time. I am sure it's not working. I came to know about joda time. It is possible to display milliseconds using it in java program. I am not sure whether it is applicable in ireport/jasperreport. I would like to know whether we can import joda api in ireport or not? has anyone worked on it in ireport? I would really appreciate if you please let me know about it. Thank you in advance.

     

    Best regards,

  10. Experts,

     

    It would be a great help if you please do let me know how to use trim() in the expression so as to remove whitespaces? At present, I am joining two fields using expression, ($F{PROJECT_CODE}+" ("+$P{PROCESS_TYPE}+")"). It's producing some white space in the pdf file affecting the alignment of the report. I thought of trim() method to so as to delete white space? Is it the right way or any method exists? please do let me know. Many thanks in advance.

     

     

    Best regards.

  11. Experts,

    I am generating a report using a query in following way.

    ID        Step Name     Run Time       Status                   Error Message

    3045   ABC                 00:00:01         SUCCESS            null (i am keeping blank in actual report. This is just to understanding.)

    3046   PQR                00:00:02          SUCCESS           null

    3047   XYZ                 00:00:02           FAIL                      error in initialization

    3048   DEF                00:00:03           FAIL                      error in file copying

    3049   IJK                  00:00:03          SUCCESS            null.

     

    I wish to display in following way.

    ID        Step Name     Run Time       Status                  Error Message

    3045   ABC                 00:00:01         SUCCESS            N/A

    3046   PQR                00:00:02          SUCCESS           N/A

    3047   XYZ                 00:00:02           FAIL                      error in initialization

    3048   DEF                00:00:03           FAIL                      error in file copying

    3049   IJK                  00:00:03          SUCCESS            N/A

     

    Do I need to change my query for this or shall i write expression/code in print when expression? in simple way, the logic is

    the logic should be: if STATUS = 'SUCCESS' then ERROR = 'n/a' ELSE ERROR = error_message.

    What do i need to do? my query is,

     

    select file.ID,file.stepName,file.RunTime,file.Status,file.Erro_code from file.

    Thank you in advance.

    Best regards.

     



    Post Edited by rajuchacha007 at 08/04/2010 07:46
  12. Experts,

    In my report, I dispalying start time details of some data processes. When the expression class is set to java.lang.String I get the result in following way.

    Start Time        2010-05-28 18:06:36.0

    If I keep the expression class to java.util.date I get following result.

    Start Time: 5/28/10 6:06 PM

    If I keep the expression to java.sql.TimeStamp I get following result.

    Start Time: 5/28/10 6:06 PM.

     

    My question is, is it possible to keep the expression class set to java.lang.String and set the clock 12 hours format instead of 24 hours format. (Right now I am able to see the time in 24 hrs format) so that i can see AM and PM along with seconds details. In other two expression classes I am not able to see seconds detail. Is it possible to achieve this? Do I need to set any property in this case? Or do I need to pass any SQl query for this? Also I see a blank page at the end of report which contains only header. I mean to say, my report is 3 pages. I see 4 pages. 4th blank one including header. Why I am seeing this? Please suggest/advise.

     

    Best regards.

  13. Hello Experts,

    I am designing a report to display some data details. While displaying those details, I need to display time difference between two data processing. There fore, in my query I am writing following to get time difference.

    select

     data.START_DATETIME,
         data.END_DATETIME,

    TIME_FORMAT(TIMEDIFF(data.end_datetime, data.start_datetime),'%H:%i:%S') as execute_time

    from

    FROM
         data

     

    My concern is to display miliseconds. I am not able to display milliseconds. Is it possible to display milliseconds using only query or should I need to write java expression in ireport? If yes, Under expression tab from text field properties, I couldn't find Date() function as such? What should I have to do in order to get time difference in milliseconds as well? Please guide/suggest/advise. Thanks in advance.



    Post Edited by rajuchacha007 at 07/24/2010 09:12
  14. @slow...indeed it worked. I have only one query in my mind. while executing it within java or while grouping this, the change i made in data type would create any problem? thanks for the suggestion man.
×
×
  • Create New...