mrong
asked on
How to keep leading zeros in Crystal Report
Greetings,
I have a number field(in '0000' format) in Access 2000. Once I populated the data on Crystal Report Viewer, I got '1' instead of '0001'. What do I need to get the format('0000') I want?
Thanks.
I have a number field(in '0000' format) in Access 2000. Once I populated the data on Crystal Report Viewer, I got '1' instead of '0001'. What do I need to get the format('0000') I want?
Thanks.
ASKER
I got error msg "the string is required->Project.ProjectI D"
When I try to save the following formular on the report:
Right('0000'+{Project.Proj ectID},4)
Thx.
When I try to save the following formular on the report:
Right('0000'+{Project.Proj
Thx.
You can also use the ToText function to accomplish this.
Create a formula and this code:
ToText({table.field},"0000 ");
This will accomplish the same thing as frodo's post, just another way to skin a cat so to speak.
Create a formula and this code:
ToText({table.field},"0000
This will accomplish the same thing as frodo's post, just another way to skin a cat so to speak.
Should be: Right('0000'+ToText({Proje ct.Project ID}),4)
Sorry - I'm not that familiar with the Access "format" and I thought it was already in text form.
Note that bdreed's suggestion is equally good.
Sorry - I'm not that familiar with the Access "format" and I thought it was already in text form.
Note that bdreed's suggestion is equally good.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
frodoman,
Your formula didn't give me the right data->'3.0' instead of '0023'.
I am trying bdreed35's formula.
Your formula didn't give me the right data->'3.0' instead of '0023'.
I am trying bdreed35's formula.
ASKER
Same output by using bdreed35's formula.
If you put just the field itself {Project.ProjectID} on the report what do you see in this example? 23? 2.3?
ASKER
I see '23' if I put {Project.ProjectID} itself.
I see '3.0' if I use your formula.
Thanks.
I see '3.0' if I use your formula.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
what do you mean by dropdown?
Thanks.
Thanks.
In the formula editor you can (probably) choose between "Crystal Syntax" and "Basic Syntax". If there is no such choice for you then probably you have an older version of crystal in which case it doesn't matter.
As long as you don't have anything on your formula editor that says "Basic Syntax" then you're fine - please do as I suggested and let me know the outcome.
As long as you don't have anything on your formula editor that says "Basic Syntax" then you're fine - please do as I suggested and let me know the outcome.
ASKER
frodoman,
I use Crystal Syntax in the dropdown menu for the formula, but I still get the same output ('3.0') by using 'right("0000"&23,4)'.
Thanks.
I use Crystal Syntax in the dropdown menu for the formula, but I still get the same output ('3.0') by using 'right("0000"&23,4)'.
Thanks.
ASKER
I got it. it shoud be
ToText ({table.field},"000000")
Thanks frodoman & bdreed35!
ToText ({table.field},"000000")
Thanks frodoman & bdreed35!
ASKER
frodoman & bdreed35,
I am gonna spit the points as following coz you are trying to help me out here.
frodoman(30) bdreed(20)
Please let me know if you have any comments.
Thanks.
I am gonna spit the points as following coz you are trying to help me out here.
frodoman(30) bdreed(20)
Please let me know if you have any comments.
Thanks.
Thanks for the points. I'm really not sure where the original problem was but as long as you've got it working...
Right('0000'+{table.datfie
This will append four zeros in front of your data (e.g.: 00001) and then will return the four rightmost characters (0001).