Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: join of hours and minutes Post Reply Post New Topic
Author Message
Despina
Newbie
Newbie


Joined: 30 Mar 2010
Location: Australia
Online Status: Offline
Posts: 31
Quote Despina Replybullet Topic: join of hours and minutes
     Posted: 23 Aug 2010 at 7:07pm
Hi
 
I have two column values that i need to join in a formular. i need to place a : in between teh two columns
 
How do I do this using crystal syntax in a formular
 
for example
 
column 1 = hours    column 2 = minutes
 
7                              21
 
7:21
 
Currently I have:
{@time hrs} & {@time minutes} which gives me 721
 
Regards,
Despina
IP IP Logged
Emir_W
Senior Member
Senior Member
Avatar

Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
Quote Emir_W Replybullet Posted: 23 Aug 2010 at 11:13pm
assume both columns are numeric.
 
you can create a formula (xhours):
 
if {field_hours}<10 then
    if {field_min}<10 then
        "0"+trim(totext({field_hours},0))+":0"+trim(totext({field_min},0))
    else
        "0"+trim(totext({field_hours},0))+":"+trim(totext({field_min},0))
else
    if {?b}<10 then
        "0"+trim(totext({field_hours},0))+":0"+trim(totext({field_min},0))
    else
        trim(totext({field_hours},0))+":"+trim(totext({field_min},0))
 
 
 
 
hope it help.
 


Edited by Emir_W - 23 Aug 2010 at 11:21pm
Emir W
IP IP Logged
Despina
Newbie
Newbie


Joined: 30 Mar 2010
Location: Australia
Online Status: Offline
Posts: 31
Quote Despina Replybullet Posted: 24 Aug 2010 at 12:05pm
Hi
 
Thankyou for your update.
I played around with it yesterday and this is what I did (which also worked)
1. defined hrs by:
if int(tonumber({Command.SUM(WRKD_MINUTES)})/60)<10 then "0"+totext(int(tonumber({Command.SUM(WRKD_MINUTES)})/60),0)
else totext(int(tonumber({Command.SUM(WRKD_MINUTES)})/60),0)
 
2.defined minutes by:
 
 
{@time hrs} + ":" + {@time minutes}
 
In your suggestion what is {?b}
 
Regards,
Despina
IP IP Logged
Emir_W
Senior Member
Senior Member
Avatar

Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
Quote Emir_W Replybullet Posted: 24 Aug 2010 at 4:05pm
Oops..
 
it supposed to be {field_min}..
(forgot to change it after testing).
 
 
 
thanks for ask and remind me.
 


Edited by Emir_W - 24 Aug 2010 at 4:13pm
Emir W
IP IP Logged
Despina
Newbie
Newbie


Joined: 30 Mar 2010
Location: Australia
Online Status: Offline
Posts: 31
Quote Despina Replybullet Posted: 24 Aug 2010 at 4:11pm

thankyou.....

IP IP Logged
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