Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4234 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have a query that I am trying to get to aggregate some time data, so want to do a SUM() on a Time field.  Data in the field is a duration (i.e. NOT a time of day) in MM:SS format, and I am trying to calculate how long something took to process.  (The table has a variety of records for the same parent object, representing various stages of work, so want to find out the total amount of time put in on a parent object.)

 

I am having trouble getting it to work,  just getting question marks in response.  Things work well with normal FM calculations. 

 

Here are a few of the things that I have tried:

ExecuteSQL (
    "SELECT SUM ( MovieRawTime_AsTime )
     FROM Movies
     WHERE MovieEditingDate > ? and MovieEditingDate < ?   "
; "" ; "" ; Date_Start ; Date_End )

Trying to convert it to raw # of seconds for summing, then would convert it back (that part isn't shown):

ExecuteSQL (
    "SELECT DATEDIFF ( MINUTE, '00:00:00', MovieRawTime_AsTime )
     FROM Movies
     WHERE MovieEditingDate > ? and MovieEditingDate < ?   "
; "" ; "" ; Date_Start ;Date_End )

Any suggestions would be appreciated,

-- J

Posted

Well you probably shouldn't be using a time field for something like this.

 

That being said, you may be able to convert it from one type to another. Try something like:

Let ( tt = ExecuteSQL ( "
                          SELECT SUM ( CAST ( MovieRawTime_AsTime AS INT ) )
                          FROM Movies
                          WHERE MovieEditingDate > ? and MovieEditingDate < ?
                        "
                        ; ""; ""; Date_Start; Date_End
                      );

      GetAsTime ( GetAsNumber ( tt ) )
    )

This topic is 4234 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.