Removing data lines

I have a crystal report
With some fields that do not contain data
I would like to suppress these and move other data up in it's place
Ie
Address 1
Address 2
Town

so I may not have any data for address2 so rather than a gap, can I then see, with no gap
Address1
Town

Gordon
Gordon HughesDirectorAsked:
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.

Éric MoreauSenior .Net ConsultantCommented:
You can create a formula field like this (basic syntax):

dim strAddress as String

strAddress =""

if not isnull({Headers.Line1}) and len({Headers.Line1}) > 0 then
    strAddress = strAddress & {Headers.Line1} & chr(10) & chr(13)
end if

if not isnull({Headers.Line2}) and len({Headers.Line2}) > 0 then
    strAddress = strAddress & {Headers.Line2} & chr(10) & chr(13)
end if

if not isnull({Headers.City}) and len({Headers.City}) > 0 then
    strAddress = strAddress & {Headers.City} & ", "
end if

Formula = strAddress

Open in new window

0

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
Gordon HughesDirectorAuthor Commented:
Hi Eric
Do I create a new formula for this and if so where do I put it?
Gordon
0
Éric MoreauSenior .Net ConsultantCommented:
yes you need to create a new formula. check https://kb.blackbaud.com/articles/Article/41726
0
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Raghavendra HullurSoftware DeveloperCommented:
An alternative way would be to display the individual fields in separate sections and suppress the sections if the particular database field displayed in that section is blank.

Something like this:

Say you are displaying the Address 1, Address 2, Town etc.. in a single section for ex. detail section.
Then, you can create as many new detail sections as the number of fields you need to display and include those individual fields like

Address 1: {Addres1 datbase field} etc.

and you can write a suppress condition at section expert for that particular section using a suppress condition like
isNull({Addres1 datbase field})

The highlighted field needs to be replaced with your database field.

Repeat this for each of the fields you need to display.
0
Gordon HughesDirectorAuthor Commented:
All
Thanks for your support
Gordon
0
James0628Commented:
FWIW, if you put the fields in separate sections (with nothing else in the section), then you should be able to just use the "Suppress blank section" option in the Section Expert to suppress those sections, rather than creating a suppression formula.  Either one works.  "Suppress blank section" is just a bit easier.

 James
0
Gordon HughesDirectorAuthor Commented:
Hi James
That is what I am doing
Thanks
Gordon
0
Raghavendra HullurSoftware DeveloperCommented:
Well, if there is nothing else in that section, then what James suggested would definitely work.
But, in case, you want to display a label for each of those fields, then the section won't be blank.
That's why I suggested to use section expert level suppression.
0
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.