Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to suppress concatenated ';' strng with an empty string?

Status
Not open for further replies.
Aug 27, 2003
428
US
Hi,

I am using Crystal 9.0. I have the below formula.

Formula = {Detail.ClassSeriesLabel} + " " + ";" + {Detail.CurrencyCode} + " " + ";" + " Mgmt Fee" + " " + ISNULL({Detail.ManFeePerc},0) + " " + ";" + " Perf Fee: " + ISNULL({Detail.PerfFeePerc},0)

When I run the report for different types of Funds, the field {Detail.ClassSeriesLabel} is at times null.

Owing to the concatenated semicolon, in the case when teh {Detail.ClassSeriesLabel} is null, I get a semicolon and the remainder of teh string.

example:
For Series type Fund:

The string will appear as

Class A;Series 1;USD;Mgmt Fee 2%;Perf Fee 20%


For cases when Class/Series value is null, which is another type of Fund: Owing to my formula, the string appears as

;USD;Mgmt Fee 2%;Perf Fee 20%


How do I get rid of the semicolon in the beginning using the same formula?

Is there a way?

Thanks!



 
Hi,
Test for the empty or NULL strings before concatenating:

Code:
If NOT IsNull({Detail.ClassSeriesLabel}) and Trim({Detail.ClassSeriesLabel}) <> "" then

{Detail.ClassSeriesLabel} + " "  + ";" + {Detail.CurrencyCode} + " " + ";" + " Mgmt Fee" + " " +  ISNULL({Detail.ManFeePerc},0) + " " + ";" +   " Perf Fee: " + ISNULL({Detail.PerfFeePerc},0) 

else

 {Detail.CurrencyCode} + " " + ";" + " Mgmt Fee" + " " +  ISNULL({Detail.ManFeePerc},0) + " " + ";" +   " Perf Fee: " + ISNULL({Detail.PerfFeePerc},0)

If other fields can also be empty or NULL then add tests as needed.





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Wow. It worked using Basic Syntax in formula editor.

When I use ISNULL({Detail.ManFeePerc},0) I get an error saying too many arguments, so I took out the ISNULL check.

Do you know whey I get an error?



If NOT IsNull({Detail.ClassSeriesLabel}) and Trim({Detail.ClassSeriesLabel}) <> "" then

Formula = {Detail.ClassSeriesLabel} + " " + ";" + {Detail.CurrencyCode} + " " + ";" + " Mgmt Fee" + " " + {Detail.ManFeePerc} + " " + ";" + " Perf Fee: " + {Detail.PerfFeePerc}

else

Formula = {Detail.CurrencyCode} + " " + ";" + " Mgmt Fee" + " " + {Detail.ManFeePerc} + " " + ";" + " Perf Fee: " + {Detail.PerfFeePerc}

end if

Thanks again!!!!

 
Never mind. I am checking for ISNULL for the remaining numeric values in the stored procedure and replacing with 0.

Besides, this issue will only happen for the Class Series win the formula.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top