How to suppress a Text Object field in Crystal Report based on Header Value. I have 2 text object fields below the Header and I want to suppress one or other based on my header.
I.e. my header is dynamic and it gets different header value.
CASE 1. In certain case if the header is "ABC" then I want to suppress or hide the 1st text object.
CASE 2. If the header is "DEF" then I want to suppress or hide the 2nd text object.
To suppress just a field and not the entire header:
Instead, click on the x+2 button on the right side.
Note: It is quite far away from the Suppress checkbox it belongs to. See screenshot below for help with finding the button.
In the formula box that appears, type your condition for suppressing the text box. For example, if you want to suppress the text field if the header is "ABC" then you may want to enter the following:
{@HeaderField} = "ABC"
However, there may be an easier way for you to go about this. Instead of having two text objects, create one formula with an IF-THEN-ELSE statement within to determine which text is displayed.
For example:
If {groupname} = "ABC" then "first set of text"
Else if {groupname} = "DEF" then "second set of text"
Else "Error"
or
If {groupname} = "ABC" then "first set of text"
Else "second set of text"
or
Select {groupname}
Case "ABC": "first set of text"
Case "DEF": "second set of text"
Default: "Error"