Report Design
 Crystal Reports Forum : Crystal Reports 9, X, XI, 2008, 2011 : Report Design
Message Icon Topic: Leading Zeros Post Reply Post New Topic
Page  of 2 Next >>
Author Message
James Rader
Newbie
Newbie
Avatar

Joined: 14 Jan 2011
Online Status: Offline
Posts: 9
Quote James Rader Replybullet Topic: Leading Zeros
    Posted: 15 Feb 2011 at 9:11am
Okay - second time asking a question. I would like to thank everyone for the replies I received on my first.
 
Here is my quandary...
 
I am totaling a count of records. This total must be 8 characters long, but the count may only come out to lets say 100. How would I go about adding leading zeros to make the length of this field to 8 so it looks like this 00000100?
Jim
IP IP Logged
DBlank
Senior Member
Senior Member


Joined: 19 Dec 2008
Online Status: Offline
Posts: 7725
Quote DBlank Replybullet Posted: 15 Feb 2011 at 9:29am
totext(summary,'00000000')
IP IP Logged
James Rader
Newbie
Newbie
Avatar

Joined: 14 Jan 2011
Online Status: Offline
Posts: 9
Quote James Rader Replybullet Posted: 15 Feb 2011 at 9:52am
maybe I should have stated the field is a text field with numbers and I am totalling using a count function
 
if field <>"" then 1 else 0
 
I have tried this:
 
 count ({OTA.Record_Count}),'00000000'
 
and  totext(count ({OTA.Record_Count}),'00000000'), but neither work.
 
Top one does not recognize the '00000000' and the second one says the formula must be a boolean.
 
Any thoughts?
Jim
IP IP Logged
DBlank
Senior Member
Senior Member


Joined: 19 Dec 2008
Online Status: Offline
Posts: 7725
Quote DBlank Replybullet Posted: 15 Feb 2011 at 9:58am
you cannot do conditional counts using the formula I gave you.
I assumed you wanted the count you already had to format as 8 characters long ... the 'summary' in my fomrula was to be replaced by your formula for your count ... something like:
totext(SUM(your_if_then_formula_field),'00000000')
 
Is this what you wanted or a different way to do conditional counting/summing?
 
 


Edited by DBlank - 15 Feb 2011 at 9:59am
IP IP Logged
James Rader
Newbie
Newbie
Avatar

Joined: 14 Jan 2011
Online Status: Offline
Posts: 9
Quote James Rader Replybullet Posted: 15 Feb 2011 at 10:06am
I get the same result - must be a boolean.
totext(SUM(Record Count),'00000000')
 
I have the count - so that is good, what I need is the count to always be 8 characters long. What am I missing?
 
Right now this is totalling 10,
Count of OTA.Record_Count
 
what I need is for it to look like this: 0000000010
Jim
IP IP Logged
DBlank
Senior Member
Senior Member


Joined: 19 Dec 2008
Online Status: Offline
Posts: 7725
Quote DBlank Replybullet Posted: 15 Feb 2011 at 10:08am
you putting the formula I gave you in the select expert?
IP IP Logged
James Rader
Newbie
Newbie
Avatar

Joined: 14 Jan 2011
Online Status: Offline
Posts: 9
Quote James Rader Replybullet Posted: 15 Feb 2011 at 10:12am
No I wasn't - I was using the formula in Number>leading Zeros.
 
Should I put it in the select expert?
Jim
IP IP Logged
DBlank
Senior Member
Senior Member


Joined: 19 Dec 2008
Online Status: Offline
Posts: 7725
Quote DBlank Replybullet Posted: 15 Feb 2011 at 10:18am
Ahhh...You are in the FOrmat Field, Numbers Tab, Customize , Leading Zero's formula...correct?
That "lead zero" is only used to do one lead zero for decimal numbers
e.g.
.11 vs. 0.11
It wants a booean formula where if it were TRUE it would show 0.11 and FALSE would be .11
That won't work for you.
Get out of it and go into the Field Explorer
Make a new formula field and use the fomrual I gave you.
Place in report canvas to change the dispaly from numeric to text with the lead zero's
IP IP Logged
James Rader
Newbie
Newbie
Avatar

Joined: 14 Jan 2011
Online Status: Offline
Posts: 9
Quote James Rader Replybullet Posted: 15 Feb 2011 at 10:21am
Perfecto - thanks for the help....
Jim
IP IP Logged
James Rader
Newbie
Newbie
Avatar

Joined: 14 Jan 2011
Online Status: Offline
Posts: 9
Quote James Rader Replybullet Posted: 18 Feb 2011 at 7:44am
New question on this - It works great except when the
totext(SUM({@Record Count}),'00000000') = 0 - I still need those 8 charachter spaces filled with zeros'. Can you help with this?
 
I have tried if then statements and if the count is 0 it leaves them blank.
Jim
IP IP Logged
Page  of 2 Next >>
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.031 seconds.

FREE ADVANCED
Crystal Reports Training!

Plus, free bonus PDF cheat sheet! Advanced Crystal Reports Training Give Me Advanced Training!