Solved

Crystal Reports 2008 String formatting question

Posted on 2011-09-14
3
243 Views
Last Modified: 2012-05-12
I have a formula which I want to do 2 things to the same field in my database. It will only do the last statement. Is there a way to have it do both? I want it to remove the period after the initial in the name field and then remove the extra space between the first and last name. It removes the extra space but the period is still there. Here is the formula:  Thanks

WhilePrintingRecords;

// This one removes period after Middle Initial

Replace ({Projects.Resource Name},"." ,"" );


// This one removes the extra space between the
// first and last names

Replace ({Projects.Resource Name},", " ,"," )



0
Comment
Question by:MidWestGirl
3 Comments
 
LVL 22

Accepted Solution

by:
Ido Millet earned 500 total points
ID: 36539122
WhilePrintingRecords;
Replace(Replace ({Projects.Resource Name},"." ,"" ), ", " ,"," );

0
 
LVL 34

Expert Comment

by:James0628
ID: 36539161
A formula can only produce one value, so your formula does the first replace, and then the second, and you get the result from the second.  Combine them in one statement, as in Ido's post.

 James
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 36539269
As written, the formula produces 2 results.   The second result is the one that is displayed.

Replace does NOT change the string in the database just makes changes for in this case display.

You can use Ido's formula.

Another way is to use a local variable in the formula

WhilePrintingRecords;
Local StringVar strTemp;
// This one removes period after Middle Initial

strTemp := Replace ({Projects.Resource Name},"." ,"" );


// This one removes the extra space between the
// first and last names

strTemp  := Replace (strTemp ,", " ,"," );

strTemp

mlmcc

0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

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

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

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now