Want to get rid of Google Ads, click here.
+ Reply to Thread
Results 1 to 3 of 3

Thread: Sum of a date/time field..

  1. #1
    Senior Member eisefr's Avatar
    Join Date
    Nov 2001
    Location
    Germany
    Posts
    538

    Default

    Hello ...



    I have a problem with a report what I generated in CrystalReports

    8.5.

    In that report I have a field called 'total'.

    It is a Date/Time - Type.



    I would like to build a sum of the values in this field.



    The problem is.. CR only COUNTS the number of values...

    but it dosn't really calculate.



    example:

    the values are: 00:15:12 + 00:12:22.

    The sum should be 00:27:34.



    But in Crystalreports i am only able to count that i have 2 values.

    So it shows me in my diagram only 2.



    I hope I explained myself good enough.



    If there are any more questions just write me back.



    Thanks for any help in advance!



    Bye from Germany.

    Frank

  2. #2
    Senior Member eisefr's Avatar
    Join Date
    Nov 2001
    Location
    Germany
    Posts
    538

    Default Got it

    The formula in CR has to be:
    Local numberVar std := Hour ({clocksm1.total});
    Local numberVar min := Minute ({clocksm1.total});
    Local numberVar sec := Second ({clocksm1.total});
    Local numberVar zeit := std * 60 + min;


    But what i forget to mention about IS:
    The field is a RELATIVE date-time - field (DD HH:MM:SS)

    CR dosn't like that at all.. :-/

    It gives you only the time of the value.

    Does anyone has experience with CR and such relative date-time fields?

    Bye
    Frank

  3. #3
    Senior Member eisefr's Avatar
    Join Date
    Nov 2001
    Location
    Germany
    Posts
    538

    Default

    Now I finally got it:

    I have a 'normal' date/time field
    (probsummarym1.open.time.open.time)
    example: 2002/06/24 12:55:13.00

    and this relative date/time field (clocksm1.total)
    example: 0000/00/02 18:56:12.00

    ----------------------------------------------------------------------


    The open.time field I want to use as filter to get datas only of a
    specified time (last full month ... last year.. or whatever)



    Step 1:
    ~~~~~~~
    In my report I click on FILE - REPORTOPTIONS.
    I have to change the option 'CONVERT DATE/TIME FIELD TO' - CHARACTER.

    Step 2:
    ~~~~~~~
    Then I click on EINFÜGEN - FIELDOBJECT
    I generated a Formel to change the character open.time back to a
    'normal' date/time value:

    DateTime (ToNumber({probsummarym1.open.time}[1 to 4]),
    ToNumber({probsummarym1.open.time}[6 to
    7]),ToNumber({probsummarym1.open.time}[9 to 10])
    ,Tonumber({probsummarym1.open.time}[12 to 13])
    ,ToNumber({probsummarym1.open.time}[15 to 16])
    ,ToNumber({probsummarym1.open.time}[18 to 19]))



    Step 3:
    ~~~~~~~
    Then I calculate the hours of the relative date/time field:

    Local numberVar std := ToNumber ({clocksm1.total}[12 to 13]);
    Local numberVar min := ToNumber ({clocksm1.total}[15 to 16]);
    (ToNumber ({clocksm1.total}[9 to 10]) * 24) + std + (min / 60)


    Hard to get the solution without a course... but I finally got it.

    Bye..
    Frank

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts