Print Page | Close Window

Suppression Syntax/Format

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22678
Printed Date: 19 Apr 2024 at 7:14pm


Topic: Suppression Syntax/Format
Posted By: blackfish
Subject: Suppression Syntax/Format
Date Posted: 09 Oct 2018 at 11:22am
I am trying to suppress a border around a text field, and two conditions have to be met.  The conditions are simple access queries. 

if {LabourFinishCategory.CATEGORY} = 20 and {LabourSpeciesCategory.CATEGORY} = 58 then 1 else 0

This returns an ODBC error.

if {LabourFinishCategory.CATEGORY} = 20 then 1 else 0

and

if {LabourSpeciesCategory.CATEGORY} = 58 then 1 else 0

Each formula works fine stand alone ( you get the wrong answer but they do not cause errors) but not in combination. Am I doing something wrong or is this a limitation in Crystal?

I have also tried using a more complex query that has both needed values in it, but that also returns an ODBC error.

if {LabourFinishSpeciesCategory.LABOUR_FINISH.CATEGORY} = 20 and {LabourFinishSpeciesCategory.LABOUR_SPECIES_DOOR_MODELS.CATEGORY} = 58 then 1 else 0







Replies:
Posted By: hilfy
Date Posted: 10 Oct 2018 at 9:15am
For a suppression formula, you don't need an If statement - you just need an expression that evaluates to True or False. So, I would change your formula to this:

{LabourFinishSpeciesCategory.LABOUR_FINISH.CATEGORY} = 20 and {LabourFinishSpeciesCategory.LABOUR_SPECIES_DOOR_MODELS.CATEGORY} = 58

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: blackfish
Date Posted: 10 Oct 2018 at 9:26am
OK, I tried your suggestion.  "There is an error in the formula""The formula result must be a number"

That is why I tried the If-Than statement


Posted By: hilfy
Date Posted: 10 Oct 2018 at 9:47am
Hmmm... what version of Crystal are you using?

You could also try this:

- Create two formulas - one with each of your If statements.
- In the suppress formula do this:

Minimum({@Formula1}, {@Formula2})

This will not suppress the box if either of the formulas = 0

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: blackfish
Date Posted: 10 Oct 2018 at 10:11am
Crystal 8.5

I made the 2 formulas each with an if-then.

wrote the new suppress formula as you suggested.
Minimum ({@CutMDF1},{@CutMDF2})

Still returns an error
"The summary / running total field could not be created"


Posted By: hilfy
Date Posted: 10 Oct 2018 at 10:29am
This is an issue with Crystal 8.5. It's very old and has been out of support for over 15 years. What you want to do may not be doable in this version.

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: blackfish
Date Posted: 10 Oct 2018 at 10:39am
I was afraid you might say that.  But I really like that version and it works the best with the proprietary software I am supporting.  Thanks for the help anyway.

Steve


Posted By: hilfy
Date Posted: 10 Oct 2018 at 10:59am
I understand. I worked in 8.5 for a number of years and had some challenges when I had to upgrade from there to XIr2. I wish I had better news for you!

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: blackfish
Date Posted: 10 Oct 2018 at 12:00pm
I got it to work in 8.5!!!!!!!

Evidently you can't reference 2 separate fields in a suppression formula. 
if A=1 and B=2 then 1 else 0  (this won't work)

So I put the compound if-then's in a single formula.
if A=1 and B=1 then 99 else
if A=1 and B=2 then 999 else
if A=3 and B=10 then 9999 else 0

Now in the suppression field I use a simple if-then.
if formulavalue = 99 then 1 else 0

On a side note, you can reference the same field twice in a suppression field.
if A=1 or A=2 then 1 else 0

I just had to think a way around the suppression limitation.



Posted By: hilfy
Date Posted: 11 Oct 2018 at 3:47am
Cool! I'm glad you were able to figure it out!

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window