Thursday, March 8, 2012

Conditional Page Header

Will Crystal Reports have a page header that will hide if a condition is not met or viceaversa? If so how is this done?
Example: If Company_Name = 'xyz' then unhide page header A
thanks in advance
cgInstead of hard coding the header,write a formula like :

if companyname = 'xyz' then

'Header name'

else

' '

and drag the formula in page header!

or

right click on Page header section,select Section Expert,select Common Tab,
click formula button on right of suppress button ,and write

companyname <> 'xyx'|||how exactly do i do this in Crystal? I will have to do the same for the footer too.

thanks
cg|||you mean writing the formula ?

I think you should go for 2nd option for both header and footer i.e suppress the section based on your condition.|||i tried the conditional supressing the header and it is not working.
i have tried with and with out checking the supress box with the formula in there.

this is what i have in the formula, the first 2 are the same. i was testing if it was case sensitive or not. this is a parameter field instead of a db field.

{?CustomerName} <> "Typenex Medical, LLC"
or
{?CustomerName} <> "TYPENEX MEDICAL, LLC"
or
{?CustomerName} <> "TYPENEX MEDICAL LLC"
or
{?CustomerName} <> "TYPENEX MEDICAL L.L.C."
or
{?CustomerName} <> "TYPENEX"
or
{?CustomerName} <> "TYPENEX LLC"

not sure if this makes a difference but i have version 8.5

thanks
cg|||i tried the conditional supressing the header and it is not working.
i have tried with and with out checking the supress box with the formula in there.

this is what i have in the formula, the first 2 are the same. i was testing if it was case sensitive or not. this is a parameter field instead of a db field.

{?CustomerName} <> "Typenex Medical, LLC"
or
{?CustomerName} <> "TYPENEX MEDICAL, LLC"
or
{?CustomerName} <> "TYPENEX MEDICAL LLC"
or
{?CustomerName} <> "TYPENEX MEDICAL L.L.C."
or
{?CustomerName} <> "TYPENEX"
or
{?CustomerName} <> "TYPENEX LLC"

not sure if this makes a difference but i have version 8.5

thanks
cg

You have written the expression wrong.
Whatever you have written will be always true in any condition. Just check it properly. Use

NOT (condition1 AND condition2 AND so on)|||Make it simple :

- Right click on Formula field in field explorer

- click New

-name your formula

Type this

if {?CustomerName} <> 'ABC' and {?CustomerName} <> 'XYZ' then

' '
else

'HEADER'

Drag the formula field in report where you want to print the header.

No comments:

Post a Comment