Crystal XI formula

Posted on 2007-07-20
Last Modified: 2012-06-27
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


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

Thank you in advance

Question by:amedexitt
    LVL 7

    Expert Comment

    What is the formula you are using so far?

    Author Comment

    field1 & ', '& filed2& ', '& field3& ', '& field4
    LVL 22

    Expert Comment

    IIF(IsNull(field1) OR field1="", "" , "," & field1) &
    IIF(IsNull(field2) OR field2="", "" , "," & field2) &
    IIF(IsNull(field3) OR field3="", "" , "," & field3) & ...
    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.
    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};



    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    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…

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now