Concat fields separated by commas

Posted on 2008-11-05
Last Modified: 2008-11-05
I have a database with several fields I need to combine, separated by commas. The problem is some of these fields will be null and I don't want to run into the issue where I see the following:

data1, data2, , ,

I want it to display as:
data1, data2

in addition if data1 is empty, I want to suppress the entire field.

Anyone able to tell me how to do this?
Question by:DarkHound
    LVL 77

    Accepted Solution

    You would have a formula field like....

    stringvar mlist;
    if isnull({table.data1}) then

    if mlist="" then
    //do nothing
    (if isnull({table.data2}) then mlist:=mlist else  mlist:=mlist & "," & {Table.Data2};
    if isnull({table.data3}) then mlist:=mlist else  mlist:=mlist & "," & {Table.Data3};
    if isnull({table.data4}) then mlist:=mlist else  mlist:=mlist & "," & {Table.Data4}

    LVL 1

    Author Comment

    hmm I don't see a formula field option
    LVL 1

    Author Comment

    Nevermind, I figured it out. Thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
    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…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    760 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

    7 Experts available now in Live!

    Get 1:1 Help Now