Concat fields separated by commas

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?
LVL 1
DarkHoundAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

peter57rCommented:
You would have a formula field like....

stringvar mlist;
if isnull({table.data1}) then
mlist:=""
else
mlist:={table.data1};

if mlist="" then
//do nothing
(mlist:=mlist
)
else
(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}
);
mlist






Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DarkHoundAuthor Commented:
hmm I don't see a formula field option
DarkHoundAuthor Commented:
Nevermind, I figured it out. Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.