Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: If statement Post Reply Post New Topic
Author Message
brent21090
Newbie
Newbie


Joined: 20 Apr 2009
Online Status: Offline
Posts: 31
Quote brent21090 Replybullet Topic: If statement
     Posted: 05 Nov 2009 at 7:18am

This should be easy but I am struggling with this.

I want all records returned where the type= S
My logic was this
 
//if {LX.LX_TYPE} ="S"
//THEN
//{LX.LX_HRS}
There is not error in the formula but I am not getting the right records back. 
 
Thanks
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Nov 2009 at 7:26am
Just use the first part in your select statement not in a formula:
{LX.LX_TYPE} ="S"


Edited by DBlank - 05 Nov 2009 at 7:26am
IP IP Logged
brent21090
Newbie
Newbie


Joined: 20 Apr 2009
Online Status: Offline
Posts: 31
Quote brent21090 Replybullet Posted: 05 Nov 2009 at 7:43am

I have two kind of records I have to return in different columns.

The transaction would have either S or R data so,
 
{LX.LX_TYPE}= "S" (This would be one column)

AND {LX.LX_TYPE}= "R" (Records would be returned in another column)

 
If I use the select statement/expert it will return all records with "S "& " R" and I need to separate these records.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Nov 2009 at 7:48am

You mean you want to create to fields in your report to display uniquely or are you expecting to do more with this (counts, sums0 etc.)

If not just place the {LX.LX_TYPE} field on your canvas twice and conditionally suppress each on opposite of each other
first one to only display "S"
Right click on it and select Format field
select Common Tab
click on formula next to Suppress
add your formula
{LX.LX_TYPE}= "R"
Save and close
Repeat for the other but swap the formula to {LX.LX_TYPE}="S"
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Nov 2009 at 7:52am

I think I see. YOu have a value in another field that you want to do this with, proabably a number field. Create 2 new formuals for this and use them each seperately.

Formula for "R" values:
If {LX.LX_TYPE}= "R" then {table.otherfield} else 0
 
Formula for "S" values:
If {LX.LX_TYPE}= "S" then {table.otherfield} else 0
 
Is this more what you want?
IP IP Logged
brent21090
Newbie
Newbie


Joined: 20 Apr 2009
Online Status: Offline
Posts: 31
Quote brent21090 Replybullet Posted: 05 Nov 2009 at 8:08am

Yeh that sound like it. I am using the formula field I had it correct but I was not sure about the else 0

IP IP Logged
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