Solved

Rounding duration within 20 min intervals

Posted on 2016-10-19
3
51 Views
Last Modified: 2016-10-19
I have a value (Duration) in Crystal reports that I want to classify in 0-20 minute intervals. i.e. every 20 mins in a day falls within a specific timeframe and gets assigned a value :-

I'm assuming something like below would need to be compiled.
(if duration <= 20 then 1 else if (duration >20 and duration <=40) then 2).....etc, I would need 71 of these.

      0 - 20mins = 1    
    21 - 40mins = 2
    41 - 60mins = 3
....................................

1401 - 1420 mins = 70
1421 - 1440 mins = 71
 
Below duration values would fall within the above mentioned

13mins         (0-20mins) = (1)
507mins       (500 - 520mins) = (26)
907mins       (900-920mins) = (46)
1358mins    (1340-1360mins) = (68)

Is there an easier way to do this in Crystal ?
0
Comment
Question by:John-S Pretorius
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 41850394
Hi,

pls try

=Fix((YourDuration-0.1)/20, 0)+1

Open in new window

Regards
1
 

Author Closing Comment

by:John-S Pretorius
ID: 41850419
Perfect Sir, Thank you.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 41850735
In Crystal there is an integer division operator

This will give you 0 to max
{YourDurationField} \ 20

Open in new window


If you want to start at 1 then just add 1
{YourDurationField} \ 20 + 1

Open in new window


mlmcc
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

742 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question