Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Help with Formula Please Post Reply Post New Topic
Page  of 2 Next >>
Author Message
shefe
Groupie
Groupie


Joined: 09 Feb 2008
Online Status: Offline
Posts: 48
Quote shefe Replybullet Topic: Help with Formula Please
     Posted: 16 Feb 2012 at 5:03am
Hello All,

i need help with the following formula to get the right enrollment per semester


if {SBNewRet.Bill code} in ["FALL11","FY2012"] 
then "2011 Fall" else
if  {SBNewRet.Bill code}in ["SPR12","FY2012"]
then "2012 Spring"


The problem i am having is that it is displaying the numbers right for 2011 Fall as 495 but for 2012 Spring , it is not pulling the people that has "FY2012 code" only SPR12 Code

Someone help
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Feb 2012 at 5:12am
it is because those people all met the condition for your first if statement and were marked as "2011 Fall"
IP IP Logged
shefe
Groupie
Groupie


Joined: 09 Feb 2008
Online Status: Offline
Posts: 48
Quote shefe Replybullet Posted: 16 Feb 2012 at 5:22am
How do i fix it becuase i need to get the numbers right
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Feb 2012 at 5:29am

I do not know how you are counting so I can't tell you how to "fix it".

1 row can have 2 answers (maybe more if you have even more billcodes).
If you are just trying to get a count you can create 2 running totals with evaluation formulas in them.
Or maybe you can create 2 formulas to check for each condition seperately And use those results...
It all depends on the rest of your design and what you are trying to do with the results.


Edited by DBlank - 16 Feb 2012 at 5:30am
IP IP Logged
shefe
Groupie
Groupie


Joined: 09 Feb 2008
Online Status: Offline
Posts: 48
Quote shefe Replybullet Posted: 16 Feb 2012 at 5:40am
I am only using 3 billcodes("FALL11","SPR12","FY2012") and some students have ("FALL11" and "SPR12")  or  ("FALL11"and "FY2012") or ("SPR12" and "FY2012")

I just want to count them , do you have a sample formula to start with ?

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Feb 2012 at 5:53am

How do you want to count them?

What do you want your summary to look like and which rows should be counted into each summarized value?
 
IP IP Logged
shefe
Groupie
Groupie


Joined: 09 Feb 2008
Online Status: Offline
Posts: 48
Quote shefe Replybullet Posted: 16 Feb 2012 at 6:09am
I want to run the total of  student names with BILLCODE,
if {SBNewRet.Bill code} in ["FALL11","FY2012"]  then "2011 Fall" else if  {SBNewRet.Bill code}in ["SPR12","FY2012"]  then "2012 Spring"

and then display the numbers of 2011 Fall and 2012 Spring separately

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Feb 2012 at 6:15am
are these stored on multiple rows for each student? each row has only one billcode and each student can have multiple rows?
 
or is it some other set up?


Edited by DBlank - 16 Feb 2012 at 6:15am
IP IP Logged
shefe
Groupie
Groupie


Joined: 09 Feb 2008
Online Status: Offline
Posts: 48
Quote shefe Replybullet Posted: 16 Feb 2012 at 7:00am
The field name full name has students names while field name bill code has many bill codes

so Student A can have

Full name     Bill code
StudentA      FY2012
                     FALL11

StudentB      Fall11

StudentC     Spr12

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Feb 2012 at 8:03am
Sorry for being picky on this but the devil is in the details and the logic is not making any sense to me.
 
From your description of
I want to run the total of  student names with BILLCODE,
if {SBNewRet.Bill code} in ["FALL11","FY2012"]  then "2011 Fall" else if  {SBNewRet.Bill code}in ["SPR12","FY2012"]  then "2012 Spring"
to your sample data of
Full name     Bill code
StudentA      FY2012
                     FALL11

StudentB      Fall11

StudentC     Spr12
I interpret this to mean that only student A would be counted as neither student b nor c had the FY2012 value.
Just guessing here but I think maybe you want a distinctcount of students for Fall11 and SPR12 and if they happen to have the FY2012 that means
coun them in both.
IF this is what you need try this.
Make one formual field called "NULL"
do not put any anything in it and save it.
Create another formula field called "Fall11" as
if {SBNewRet.Bill code} in ["Fall11","FY2012"]  then {table.studentID} else {@NULL}
Create another formual field called "SPR12" as
if {SBNewRet.Bill code} in ["SPR12","FY2012"]  then {table.studentID} else {@NULL}
 
Now you can do a distinctcount of @FALL11 to see how many students were in this group.
Now you can do a distinctcount of @SPR12 to see how many students were in this group.
Does this do what you need?


Edited by DBlank - 16 Feb 2012 at 8:04am
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