[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
Solved

# Remove a preceding zero from report in crystal

Posted on 2011-10-14
Medium Priority
284 Views
I have a field in Crystal Reports 2011 with serial numbers : (No grouping is being done, only sorting accending - so they show up first)

123456789
987564321
023456789

I need to create a formula that checks each number and if it has a preceding zero, to remove it and just show the remaining numbers :
023456789
will be changed to
23456789

0
Question by:John-S Pretorius
• 3

Expert Comment

ID: 36970326
I took into account this maybe just for the first number and there wouldn't be 2 or 3 preceding zeros.

IF LEFT(field,1) = 0 THEN
MID(field,2)
ELSE
field
0

Author Comment

ID: 36970472
Keep getting an error that a number is required here, it seems that the {serial} number field I'm applying this formula too is a string.
0

LVL 101

Accepted Solution

mlmcc earned 1000 total points
ID: 36970480
Actually you need to look for the character 0

IF LEFT({field},1) = '0' THEN
MID({field},2)
ELSE
{field}

If there can be more than 1 0 at the front try

Local StringVar strOut;
strOut := {YourField};
While (Left(strOut,1) = '0' do
strOut := mid({YourField},2);
strOut

mlmcc
0

Author Comment

ID: 36971051
The second formula worked great.

Thank you.
0

Author Closing Comment

ID: 36971054
Thank you, like always - that was perfect.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
###### Suggested Courses
Course of the Month18 days, 9 hours left to enroll

#### 825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.