Print Page | Close Window

Leading Zeros

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=12329
Printed Date: 19 Apr 2024 at 7:58am


Topic: Leading Zeros
Posted By: James Rader
Subject: Leading Zeros
Date 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



Replies:
Posted By: DBlank
Date Posted: 15 Feb 2011 at 9:29am
totext(summary,'00000000')


Posted By: James Rader
Date 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


Posted By: DBlank
Date 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?
 
 


Posted By: James Rader
Date 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


Posted By: DBlank
Date Posted: 15 Feb 2011 at 10:08am
you putting the formula I gave you in the select expert?


Posted By: James Rader
Date 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


Posted By: DBlank
Date 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


Posted By: James Rader
Date Posted: 15 Feb 2011 at 10:21am
Perfecto - thanks for the help....

-------------
Jim


Posted By: James Rader
Date Posted: 18 Feb 2011 at 7:44am
New question on this - It works great except when the
totext(SUM( mailto:%7b@Record - {@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


Posted By: ijoe619
Date Posted: 20 Feb 2011 at 2:26pm
http://www.plrprivatelabelrights.com/plr-articles/debt - PLR Debt Articles


Buy PLR articles and PLR content for all your website needs. High quality niche PLR articles, ebooks and videos in limited edition.


Posted By: alvarezdda
Date Posted: 15 Nov 2013 at 5:04am
I need show this number for example: 15
to 00000015

-------------
Daniel Alvarez



Print Page | Close Window