Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: IF Expression In Select Expert Post Reply Post New Topic
Author Message
pcr1984
Newbie
Newbie
Avatar

Joined: 29 May 2012
Online Status: Offline
Posts: 2
Quote pcr1984 Replybullet Topic: IF Expression In Select Expert
    Posted: 29 May 2012 at 11:24pm

Hi All,

I am currently writing a crystal report but have hit a bit of a brick wall and I'm hoping someone will be able to help me.
 
In brief what I am trying to do is:
 
The table I am looking at is for Estimates we create and for 1 estimate it can have upto 5 components
 
EG: Est 1 - Comp 1, Comp 2, Comp 3, Comp 4 and Comp 5
 
What I want to see is the first available Component per estimate. Unfortunately it is not as simple are as {Comp}= "Comp 1" because our estimators are able to delete "Comp 1", making "Comp 2" the first component.
 
What I need is something along the lines of:
 
If Comp 1 is the first compent hide the rest else
if Comp 2 is the first compent hide the rest
 
Have tried:
 
if {Comp}="Comp 1" then {Comp}="Comp 1" else
if {Comp}="Comp 2" then {Comp}="Comp 2" else
...
 
Any help you can give would be much appreciated.
 
Thank you Smile
IP IP Logged
Gurbs
Senior Member
Senior Member
Avatar

Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Quote Gurbs Replybullet Posted: 29 May 2012 at 11:37pm
I'm not sure if I got what you want, but try something like this:

if not isnull({Comp 1}) then {Comp 1}
else if isnull({Comp 1}) and not isnull({Comp 2}) then {Comp 2}
else if isnull({Comp 1}) and isnull({Comp 2}) and not isnull({Comp 3) then {Comp 3}
...

This what you are looking for?
IP IP Logged
pcr1984
Newbie
Newbie
Avatar

Joined: 29 May 2012
Online Status: Offline
Posts: 2
Quote pcr1984 Replybullet Posted: 30 May 2012 at 12:17am
Thank you for your response unfortunately this didn't work this time but I have worked it out now.
 
The solution lay in the "Suppression" function in "Section Expert" not the "Select Expert".
 
I assigned a Value to each Comp possibility
IE: Comp1 = 1 , Comp2 = 2 etc.
 
Did a summary by esimate to show the Minimum Value so if Comp1 wasn't there the min value would be 2 and so on.
 
Then in Section Expert / Detail / Suppress I put in the formula:
 
if {@comp}=Minimum ({@comp}, {Estimate-ID}) then false else true
 
This supressed all the higher values and left me with the first component for each estimate.
 


Edited by pcr1984 - 30 May 2012 at 12:17am
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.016 seconds.