Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Problem with visualisation of formatted number Post Reply Post New Topic
Author Message
Bjorn-V
Newbie
Newbie


Joined: 07 Jul 2009
Online Status: Offline
Posts: 1
Quote Bjorn-V Replybullet Topic: Problem with visualisation of formatted number
    Posted: 07 Jul 2009 at 6:23am
Hey,

my report is based on a database.
In the database their is an integer field with the time in seconds.
The people who uses the report wants to view this number in
hours:minutes:seconds. Changing the database is a no go, because the program uses those seconds to calculate several things.

I formated the number with a calculation in the formula editor but now it always shows decimals.
My question is how to remove those decimals.

For example:
Database : 554
after calculating it becomes 9 min and 14 seconds but the report displays it like this: 0,00:9,00:14,00

My code to do this is:
Local numberVar i := ToNumber({tblGesprek.duratiecommunicatie});
Local stringvar outputString := "";
Local numberVar uren := 0;
Local numberVar minuten := 0;
Local numberVar seconden := 0;

while i >= 3600 do
(
uren := uren + 1;
i := i - 3600;
);

while i >= 60 do
(
minuten := minuten + 1;
i := i - 60;
);
seconden := i;

uren := Truncate(uren);
minuten := Truncate(minuten);
seconden := Truncate(seconden);

outputString := ToText(Truncate(uren)) + ":" + ToText(Truncate(minuten)) + ":" + ToText(Truncate(seconden));


the code to calculate the time is correct but i want the decimals to disappear!
How is this possible??

Thanks in advance and sorry about the english
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 21 Jul 2009 at 6:38am
outputString := ToText(Truncate(uren),0,"") + ":" + ToText(Truncate(minuten),0,"") + ":" + ToText(Truncate(seconden),0,"");
 
your totext is not telling Crystal to give 0 decimal places and to use "" for the thousand separator.
 
Changes given should help.

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.