Reputation: 3970
I am using the Crystal Reports 2011 designer just to test it out. I need to be able to hide certain components, e.g. a sub-report, when exporting to different formats like Excel or .pdf. I'm guessing this can be achieved through the Suppress field with a formula, but I can't find the right syntax. Needs to be something like this:
If ExportFormat="Excel" then Suppress
Else if ExportFormat="PDF" then Show
Upvotes: 0
Views: 6845
Reputation: 3970
It doesn't seem like there is a variable to represent the ExportFormat type when using expressions in Crystal Reports.
It is possible to overcome this problem by setting a parameter programmatically during an export event i.e. create a parameter @ExportFormat and during the export event set this parameter depending on the type of export e.g. if the export taking place is to Excel, set @ExportFormat="Excel". Then the following expression can be used to suppress a control:
{?@ExportFormat}='Excel'
Upvotes: 3
Reputation: 1728
You got it almost completely right:
If ExportFormat='Excel' then TRUE
Else if ExportFormat='PDF' then FALSE
This formula goes into the suppress formula. (You need to click this small button with the "x-2" and pencil on it...)
Upvotes: 1