Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: If Then Question Post Reply Post New Topic
Page  of 2 Next >>
Author Message
hugo69
Groupie
Groupie


Joined: 15 Feb 2010
Online Status: Offline
Posts: 53
Quote hugo69 Replybullet Topic: If Then Question
     Posted: 08 Mar 2010 at 9:16pm

I have two filed types. How do I show this.

 
Here is an example
 
If detail {field1} = "help" and detail {field2} = "stop"
then not {field1} = "help" and not {field2} = "stop"   in one group details section
 
but other groups that just have detail section  {field1} = "help" but not {field2} = "stop" then 1 else 0
 
How would I write this formula.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Mar 2010 at 7:11am
You cannot alter the data in the field as i tlooks like you are trying to do in the second part of your statement (the NOTs).
Not using code what do you want to do here?
IP IP Logged
hugo69
Groupie
Groupie


Joined: 15 Feb 2010
Online Status: Offline
Posts: 53
Quote hugo69 Replybullet Posted: 09 Mar 2010 at 8:43am
What I am trying to do is this?
 
If Group 1 has the 2 fields detail {field1} = "help" and detail {field2} = "stop" then I don not want a 1 in either field
 
Then if Group 2 doesn't have detail {field2} = "stop" but has the detail {field1} = "help" then I want a 1.
 
Does that make sense?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Mar 2010 at 8:52am
Mostly but I do not know what you mean by  Group 1 and group 2.
Is that just the the first and second fields in a single group?
Also you cannot insert a Zero into a field. The data is what it is. YOu can create other formulatic fields for your 1 and 0 but it does not actually alter the existing table fields.


Edited by DBlank - 09 Mar 2010 at 8:53am
IP IP Logged
hugo69
Groupie
Groupie


Joined: 15 Feb 2010
Online Status: Offline
Posts: 53
Quote hugo69 Replybullet Posted: 09 Mar 2010 at 9:18am
Ok I have my data separated into groups by inmate booking id's.
So each of the Id's have a either the 2 data fields or just the 1.
 
I want to somehow if the Id has both data fields to not give me a 1 in either like If detail {field1} = "help" and detail {field2} = "stop" then 1 else 0.
 
But if some Ids have only the detail {field1} = "help" then 1
 
So it would show something like this?
 
Inmate ID       Field 1           Field2
100                  help              null                       1
200                  help              stop                      0
300                  null               stop                      0
400                  help              null                       1
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Mar 2010 at 9:40am

If it really is only the one row per inamte ID then create a formula field as:

if NOT (field1='help' and field2='stop') then 1 else 0
 
IN the upper right hand corner of the formula Editor their is a pick list that says 'Exceptions for Nulls'. Change it to use the 'Default Values for Nulls'.
IP IP Logged
hugo69
Groupie
Groupie


Joined: 15 Feb 2010
Online Status: Offline
Posts: 53
Quote hugo69 Replybullet Posted: 09 Mar 2010 at 10:00am
No they are in different rows sorry.
 
inmate ID                  Field1             field2
100
     row 1                     help
200
     row 1                     help
     row2                                           stop
 
and so on.... Sorry again.
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Mar 2010 at 12:01pm
Are you trying to get a count of inmates that do not have BOTH Help and STOP?
Group on the inmate ID
Make a Running Total "InmateCount"
Field to SUmmarize=InmateID
SummaryType = DistinctCount
Evaluate=Use a formula
NOT(Maximum(field1,inmateid)='Help' and Maximum(field2,inmateID)='Stop')
Reset= Never
Plce in Report footer
 
IP IP Logged
hugo69
Groupie
Groupie


Joined: 15 Feb 2010
Online Status: Offline
Posts: 53
Quote hugo69 Replybullet Posted: 09 Mar 2010 at 12:29pm
No
Just to count the field = Help for each inmate but not count the ones in the inmates that have both Help and Stop.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Mar 2010 at 1:09pm

Same process but change the evaluate formula for that logical condition...

Group on the inmate ID
Make a Running Total "InmateCount"
Field to SUmmarize=InmateID
SummaryType = DistinctCount
Evaluate=Use a formula
Maximum(field1,inmateid)='Help' and NOT(Maximum(field2,inmateID)='Stop')
Reset= Never
Plce in Report footer
IP IP Logged
Page  of 2 Next >>
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