Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: convert DateTime field to minute Post Reply Post New Topic
Author Message
rp123
Groupie
Groupie


Joined: 26 Feb 2009
Location: United States
Online Status: Offline
Posts: 47
Quote rp123 Replybullet Topic: convert DateTime field to minute
    Posted: 26 Feb 2009 at 11:53pm
Hey Guys,

I need help with DateTime field in crystal report XI.

Q1. I need to convert the {probsummarym1.outage.dur} DateTime field to minute.

For example it display 2:48 AM as time and I need to convert it to minute.

Q2. I want to sum the {probsummarym1.outage.dur} and {probsummarym1.delayed.dur}. These are DateTime fields and for example display 2:48 AM as data in report.Then I need to create the chart for the total minute.

I am very new to Crystal Report so can you write step by step process?

Thanks
rp
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 27 Feb 2009 at 1:01am

Hi

Please can you post some sample records for both datetime fields,Also what type of chart needs to be generated and the data to be displayed on X-axis and Y -axis.
 
Cheers
Rahul
IP IP Logged
rp123
Groupie
Groupie


Joined: 26 Feb 2009
Location: United States
Online Status: Offline
Posts: 47
Quote rp123 Replybullet Posted: 27 Feb 2009 at 1:12am
Sample record for {probsummarym1.outage.dur}

02:48:00AM
12:39:00 AM
09:43:00AM

Sample record for {probsummarym1.delayed.dur}

01:17:00PM
1:39:00 AM
08:40:00PM

I have to create single bar chart which display total sum for both fields ({probsummarym1.delayed.dur} & {probsummarym1.outage.dur})

Another question.

Q.When I export the report to excel it mess up all the format/settings. How can I get the correct excel format.


rp
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 27 Feb 2009 at 2:34am

Hi

This is what you do

Create the below formulas

Frm_outage_Mins

Minute({probsummarym1.outage.dur})

Frm_delayed_Mins
Minute({probsummarym1.delayed.dur})

 
Then Insert Summary,in that Field to summarize select the Frm_outage_Mins type of summary sum and insert in report footer this will give you sum for outage minutes.
 

Repeat the same steps for delayed minutes

 
This will give you total minutes for outage and delayed, then create a final formula to add the output of the above formulas.
 

Frm_Total_Mins
{@Frm_delayed_Mins}+{@Frm_Outage_Mins}

this will give you total minutes.

 
Then Insert Chart in report header ,then in data tab select for all records.

Show Values
Move the Frm_Total_Mins formula 

 
Click Ok
 
Ans2) for exporting to excel depends what expoting options you are using you will need to read guidelines in crystal help......
 
Cheers
Rahul


Edited by rahulwalawalkar - 27 Feb 2009 at 2:37am
IP IP Logged
rp123
Groupie
Groupie


Joined: 26 Feb 2009
Location: United States
Online Status: Offline
Posts: 47
Quote rp123 Replybullet Posted: 27 Feb 2009 at 3:01am
Thanks for quick reply.

I ran the formula but it just shows the minute only.

Take a example: I have 2 hours and 48 minute as data but when the formula is run then it just shows the minute part only i.e. 48 minute.

I want to convert the 2 hours also so the total minute for 2 hours 48 minute will be 168 minute.

rp
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 27 Feb 2009 at 4:46am
Hi
 
Sorry for the previous formulas here what you do
 
Convert Hours to Minutes
 
Frm_HrstoMinutes
Local TimeVar TT;
local numbervar hours;
TT := Time({probsummary.outagedur});
// Parse out the hours portion of the string and
// multiply by 3600 to convert to seconds
hours := tonumber(totext(tt)[1 to 2])* 3600;
hours/60
Convert Minutes to Number
 
MinutestoNumber
Local TimeVar TT;
local numbervar minutes;
TT := Time({probsummary.outagedur});
// Parse out the minutes portion of the string and
// multiply by 60 to convert to seconds
minutes := tonumber(totext(tt)[4 to 5]) * 60;
// Add up all the seconds
minutes/60
 
Then add final formula
 
Total Minutes
 
Then Insert summary Sum Total Minutes in Report Footer
 
For Chart Show Values select formula Total Minutes.
 
Cheers
Rahul
 
IP IP Logged
rp123
Groupie
Groupie


Joined: 26 Feb 2009
Location: United States
Online Status: Offline
Posts: 47
Quote rp123 Replybullet Posted: 27 Feb 2009 at 6:52pm
Hi,

I have one problem coming. Take a example:

I have 00:39 AM as the data so when the formula is run it is also converting the 00 to minute. The actual minute used in this case should be only 39 minutes not 759 minutes. Can you help?
rp
IP IP Logged
rp123
Groupie
Groupie


Joined: 26 Feb 2009
Location: United States
Online Status: Offline
Posts: 47
Quote rp123 Replybullet Posted: 27 Feb 2009 at 8:02pm
and how  to convert a data which is:


1 18:37 AM to minutes where 1 is one day and 18 is hours and 37 is minutes.

The answer is 2557 minutes.
rp
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.016 seconds.