Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Problems converting % of minutes to actual minutes Post Reply Post New Topic
Author Message
DJLeadfoot
Newbie
Newbie


Joined: 04 Sep 2013
Online Status: Offline
Posts: 12
Quote DJLeadfoot Replybullet Topic: Problems converting % of minutes to actual minutes
    Posted: 14 Nov 2013 at 4:22am
Hi there,
I'm having a problem doing a Mod operation in Crystal 2008 and I'm not even sure this is the best approahc.

Here's my scenario:
Minutes = 167
I want to display this in hours and minutes so it breaks down to 2.78 (2 hours and 78/100). I want to display the ".78" but equate it in minutes "47" (rounded)

So the end goal is to display 167 minutes as 2.47 as a number for additional math operations. My approach was to use the Mod operator but I'm having a problem getting the exact syntax. Tried many variations of either Remainder or Mod but to no successful outcome.

Thanks as always,
Chuck
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 14 Nov 2013 at 4:50am
local numbervar x:={table.minutes};
local numbervar mn:=x mod 60;
local numbervar hr;

x:=x-mn;
hr:= x/60;
hr+mn/100;

Should work...

HTH
IP IP Logged
DJLeadfoot
Newbie
Newbie


Joined: 04 Sep 2013
Online Status: Offline
Posts: 12
Quote DJLeadfoot Replybullet Posted: 14 Nov 2013 at 6:34am
Thanks very much ... that worked well.

Cheers!
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.