?
Solved

Crystal Reports 2008 String formatting question

Posted on 2011-09-14
3
Medium Priority
?
301 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 23

Accepted Solution

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

0
 
LVL 35

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 101

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

719 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