Solved

Crystal Reports 2008 String formatting question

Posted on 2011-09-14
3
267 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

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. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

772 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