Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Suppression Syntax/Format Post Reply Post New Topic
Author Message
blackfish
Newbie
Newbie


Joined: 08 Nov 2011
Online Status: Offline
Posts: 17
Quote blackfish Replybullet Topic: Suppression Syntax/Format
    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




IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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
IP IP Logged
blackfish
Newbie
Newbie


Joined: 08 Nov 2011
Online Status: Offline
Posts: 17
Quote blackfish Replybullet 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
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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
IP IP Logged
blackfish
Newbie
Newbie


Joined: 08 Nov 2011
Online Status: Offline
Posts: 17
Quote blackfish Replybullet 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"
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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
IP IP Logged
blackfish
Newbie
Newbie


Joined: 08 Nov 2011
Online Status: Offline
Posts: 17
Quote blackfish Replybullet 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


Edited by blackfish - 10 Oct 2018 at 10:45am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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
IP IP Logged
blackfish
Newbie
Newbie


Joined: 08 Nov 2011
Online Status: Offline
Posts: 17
Quote blackfish Replybullet 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.

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 11 Oct 2018 at 3:47am
Cool! I'm glad you were able to figure it out!
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.014 seconds.