DSE
DSE

Reputation: 21

In Crystal Reports, how do I Suppress a Text Object if any row contains a certain value

In my report, I want to display a warning text object in the report header if a column value in any row contains a certain value.

"Warning, this report has problems"

How to I construct a suppression formula for the text object to accomplish this?

If there is some other way to hide/display it, that would be fine also.

Upvotes: 1

Views: 16854

Answers (3)

agerber85
agerber85

Reputation: 73

Nick nailed it, but he left out one step.

  1. Right-click the text object
  2. Select "Format Text...", which opens the "Format Editor" dialog.
  3. In the "Format Editor" dialog, go to Common Tab.
  4. There is a Suppress checkbox. To the right [o]f it, there is a button with a x2. Click this button
  5. In the formula editor, write a formula that returns true if this "certain value" is in the row, or false otherwise

Upvotes: 0

heringer
heringer

Reputation: 3188

Let's assume you are interested in the ocurrence of value "WarningValue" in the column "MyColumn" in the table "Result".

First, create a formula. Let's call it "MyFormula". It should be like this:

if not isnull({Result.MyColumn}) and {Result.MyColumn} = "WarningValue" then 1 else 0

Then put this formula in details session. You can suppress it.

Then click on the report header using the right button. In the context menu, select "insert section below". Put a text box with the message "Warning, this report has problems" inside this new section. Click in this section using the right button and select "section expert" in the context menu. Put the following formula in the "suppress" option:

sum({@MyFormula}) < 1

So if the report count at least 1 occurrence of the "WarningValue", it will not suppress that message.

Upvotes: 0

Nick
Nick

Reputation: 3337

How to I construct a suppression formula for the text object to accomplish this?

  1. Right click the text object
  2. Go to Common Tab
  3. There is a Suppress checkbox to the right if it there is a button with a x2, click this button
  4. In the formula editor write a formula that returns true if this "certain value" is in the row or false otherwise

Upvotes: 2

Related Questions