Way Strange. Still doesn't work.

MySQL DB. myISAM
Default Character Set latin1
Default Collation: latin1_swedish_ci

the field I am totalling is a MySQL Time field.

This is how the DB is set up as default.

Custom Action
select sec_to_time(sum(Time_To_Sec(r_recordingtotal))) from Recordings where 
Recordings.r_recordingidnum = <@ARG recordingnum>

Result set to
<@assign request$Totalmin "@@resultset">
<@assign request$Totaltimeseconds "<@timetosecs '@@Totalmin'>">


Result page set up
Totalminutes  @@TotalMin<BR>
Total seconds @@Totaltimeseconds<BR>

Results in Browser
Totalminutes
00:00:24
Total seconds Invalid time!

I have tried to
select cast(sec_to_time(sum(Time_To_Sec(r_recordingtotal))) as time) from 
Recordings where Recordings.r_recordingidnum = <@ARG recordingnum>


That also doesn't work.

I also tried your script and I got invalid time as well in line 3 below.

<@ASSIGN duration_total '@@resultset'>
total duration: @@duration_total (string) <br/>
<@ASSIGN duration_total <@TIMETOSECS @@duration_total>>
total duration: @@duration_total (seconds)<br/>


in Witango.ini

Timeformat is set to : %H;%M:%S

If I put in raw time, 00:00:24 it works great.

So it seems like there is something in what is being returned that makes the 
data incompatible.

I also checked the System Preferences on my server and didn't see anything 
there that caught my eye.

Can you see anything?

Mark




On Mar 29, 2013, at 7:56 AM, Robert Shubert wrote:

Mark,

@TIMETOSECS is the solution, what you have should work. I wrote the below 
script as a test, and it functioned as expected:

<@ASSIGN duration_part '00:00:20'>
<@ASSIGN duration_total '00:00:40'>

partial duration: @@duration_part (string)<br/>
total duration: @@duration_total (string) <br/>

<@ASSIGN duration_part <@TIMETOSECS @@duration_part>>
<@ASSIGN duration_total <@TIMETOSECS @@duration_total>>

partial duration: @@duration_part (seconds)<br/>
total duration: @@duration_total (seconds)<br/>

ratio: <@CALC "@@duration_part / @@duration_total">

-----Original Message-----
From: Mark Weiss [mailto:[email protected]]
Sent: Friday, March 29, 2013 12:27 AM
To: [email protected]<mailto:[email protected]>
Subject: TeraScript-Talk: Question About Converting Time to Something Numeric

I have @@totaltime set to 00:00:40, a sum coming our of a time field in MYSQL.


I have @@totalPlayerTime set to 00:00:20

I want to <@CALC "@@totalplayertime / @@totaltime"> to get a percentage.

I can't seem to make that work.

I have tried timetosecs and that doesn't work either.

<@CALC '<@timetosecs time="@@totalplayertime"> / <@timetosecs 
time="@@totaltime">'>

And that doesn't work either.

I guess I need to find a way to convert the time to a number in both cases and 
divide to get a percentage and the convert it back to time.

Can someone help me clean that up?

Thanks

Mark


NOTICE: This email message is for the sole use of the intended recipient(s) and 
may contain confidential and privileged information. Any unauthorized review, 
use, disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply email and destroy all copies of 
the original message.




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

To unsubscribe from this list, please send an email to 
[email protected]<mailto:[email protected]> with "unsubscribe 
terascript-talk" in the body.




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

To unsubscribe from this list, please send an email to 
[email protected]<mailto:[email protected]> with "unsubscribe 
terascript-talk" in the body.



 NOTICE: This email message is for the sole use of the intended recipient(s) 
and may contain confidential and privileged information. Any unauthorized 
review, use, disclosure or distribution is prohibited. If you are not the 
intended recipient, please contact the sender by reply email and destroy all 
copies of the original message.




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

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe terascript-talk" in the body.

Reply via email to