Calculate minutes

Hello smart people.  I am working on an interactive IV pump that needs to calculate durations based on weight/dose etc.  My one calculation will give me hours and decimals currently.  IE, 12.25 hours is 12 hours 15 minutes.  I know I need to get the remainder (0.25) and multiply by 60.  My question is how do I get the remainder from that calculation

Any help is appreciated.

Thanks

Tim

 

3 Replies
Walt Hamilton

You can try dividing the total time by 10,000,000 and then multiplying it by 10,000,000. Since SL only keeps 7 digits after the decimal, that will strip off the decimal part. Since it rounds the 7th digit, you need to subtract .5 before you start. Subtract that result from the original number, and you'll have the decimal part.

See the attached sample.

EMS Training

Walt;

thank you for this.  Unfortunately, Storyline 360 no longer rounds off like this.  I ran your example in 360 and it did not work so I went to an older Storyline 2 and it worked fine.

Back to the drawing board if anyone else has any ideas on how to round off a variable or strip decimals it would be appreciated.

Tim

Walt Hamilton

Afraid of that

One option would be to keep adding 0 until you find the upper limit of SL 360.

An easier option is to use Javascript.

Try the JS slide on the sample, but remember js won't run unless it is published.

Oops, I just realized I'm re-using some old code, and I called the variables minutes and seconds, and you wanted hours and minutes. Just a heads up.