Solved

# Crystal XI formula

Posted on 2007-07-20
639 Views
I want to concatenate 10 field in Crystal XI, some time some of the field are null and I want to separate they by commas or any thing else, My issue is that I'm getting the following result

Name,lastname,,,,,Country

I want to get rid of the commas on the middle; I want the commas only if there are two consecutive fields.

0
Question by:amedexitt

LVL 7

Expert Comment

What is the formula you are using so far?
0

Author Comment

field1 & ', '& filed2& ', '& field3& ', '& field4
0

LVL 22

Expert Comment

IIF(IsNull(field1) OR field1="", "" , "," & field1) &
IIF(IsNull(field2) OR field2="", "" , "," & field2) &
IIF(IsNull(field3) OR field3="", "" , "," & field3) & ...
0

LVL 22

Accepted Solution

Actually, assuming the first field is always not empty, you should use:

field1 &
IIF(IsNull(field2) OR field2="", "" , "," & field2) &
IIF(IsNull(field3) OR field3="", "" , "," & field3) & ...

Otherwise the formula has to deal with a possible comma at the start of the result.
0

LVL 100

Expert Comment

Another idea

Local StringVar strMyField := "";
If (Not IsNull({Field1})) then
strMyField := {Field1};
If (Not IsNull({Field2})) then
strMyField := strMyField & ", " & {Field2};
If (Not IsNull({Field3})) then
strMyField := strMyField & ", " & {Field3};
If (Not IsNull({Field4})) then
strMyField := strMyField & ", " & {Field4};
If (Not IsNull({Field5})) then
strMyField := strMyField & ", " & {Field5};
If (Not IsNull({Field6})) then
strMyField := strMyField & ", " & {Field6};
If (Not IsNull({Field7})) then
strMyField := strMyField & ", " & {Field7};
If (Not IsNull({Field8})) then
strMyField := strMyField & ", " & {Field8};
If (Not IsNull({Field9})) then
strMyField := strMyField & ", " & {Field9};
If (Not IsNull({Field10})) then
strMyField := strMyField & ", " & {Field10};

strMyField

mlmcc
0

## Featured Post

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…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…