Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: formatting number in a concatenated group header Post Reply Post New Topic
Author Message
Crystal Method
Newbie
Newbie
Avatar

Joined: 06 Oct 2008
Location: United Kingdom
Online Status: Offline
Posts: 15
Quote Crystal Method Replybullet Topic: formatting number in a concatenated group header
     Posted: 28 Jan 2010 at 8:33am
How can I fomat a number output within a Group header so that the numbers appear formatted without decimal places?
 
Group header formula:
 
if {@forDaysLate} < 0 then "number of orders "&truncate({@forDaysLate})&" days late =" else if
{@forDaysLate} > 0 then "number of orders "&truncate({@forDaysLate})&" days early =" else "number of orders on time ="
 
forDaysLate formula
 
Datediff("d",datevalue({RELFBL.BELEGDATLIEF}) ,datevalue({RELFB.SEGM2_TERM}))
 
I was hoping that the 'truncate' function would remove the '.00' from the number of days late.
 
example output:
number of orders -3.00 days late =
number of orders on time =
number of orders 5.00 days early =
 
If I put the 'forDaysLate' formula in the report, I can format the number using right click -> format field.
 
How do I do it within a formula??
 
It would be helpful to remove the negative symbol '-' from the 'days late' number as well.
 
Any ideas guys?
Seagate Crystal Reports 8.5.0.389 in the guise of INFOR:Reports as part of Infor:COM ERP software.
IP IP Logged
davejwhite
Newbie
Newbie


Joined: 19 Jan 2010
Online Status: Offline
Posts: 34
Quote davejwhite Replybullet Posted: 29 Jan 2010 at 1:17am
Hi,
 
Sounds like a job for .. ToText(). The ToText function allows you to do just this. So
 
ToText({forDaysLate},0,"")
 
The 2nd argument is the number of decimal places.
The 3rd argument is whatever you want as the thousand separator in between double quotes (string argument). In this case, nothing.
 
To remove the '-', try multiplying your value by -1.
 
Good luck
IP IP Logged
Crystal Method
Newbie
Newbie
Avatar

Joined: 06 Oct 2008
Location: United Kingdom
Online Status: Offline
Posts: 15
Quote Crystal Method Replybullet Posted: 01 Feb 2010 at 12:39am
Hi davejwhite
 
Thanks for your help.  It worked a treat!
 
new formula ...totext(({@forDaysLate}*-1),0,"")...
 
Thanks for your help
 
CM
Seagate Crystal Reports 8.5.0.389 in the guise of INFOR:Reports as part of Infor:COM ERP software.
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