MidWestGirl
asked on
Crystal Reports 2008 String formatting question
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},", " ,"," )
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},", " ,"," )
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
James