Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Select Expert <> error Post Reply Post New Topic
Page  of 2 Next >>
Author Message
JCraig
Newbie
Newbie


Joined: 27 Feb 2012
Location: United States
Online Status: Offline
Posts: 6
Quote JCraig Replybullet Topic: Select Expert <> error
     Posted: 27 Feb 2012 at 8:22am

Basically do cross tabs and summaries fail if you use the select expert to exclude data like a program name or service description?

We have 63 programs that make up our non-profit. Some of my year end reports (like counting the number of consumers in the counties we serve) exclude our housing participants as they are counted in other ways.

My conundrum is my reports use cross-tabs or summaries to summarize the data and if I’m using the select expert to exclude a program or service area; for example:

{SERVICE_AREA.SERVICE_DSC} <> "Housing"

or

{V_CONSUMER_PROGRAM.PROGRAM_DSC} <> “MFIP – S”

my totals do not equal the total if the above lines were not there minus housing or MFIP – S.

Another way to put it is my count should be 2,616. My MFIP- S program had 268 people in it in 2011 so the total when I exclude that program should be 2,348 but both my cross tab and basic summary (insert summary) give me a total of 2,352. A difference of 264.

The same thing happens with the housing service_dsc.

Any suggestions you may have would be hugely appreciated.

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Feb 2012 at 9:03am
1. if you are using any outer joins, adding in new select expert criteria may alter outer joins toa ct like an inner join
2. if adding in this select criteria is the first time youa re using any field from either of these joined tables and you did not enforce the join in the DB set up you now have an enforced join which could change your numbers. one test of this is to remove the criteria from your select statement, go into preview mode. drag and drop any field from each of these table (one at a time) and watch to see if you numbers start changing by just adding a field.
IP IP Logged
JCraig
Newbie
Newbie


Joined: 27 Feb 2012
Location: United States
Online Status: Offline
Posts: 6
Quote JCraig Replybullet Posted: 27 Feb 2012 at 9:20am
Thanks for the tips DBlank,

We do use a Left Outer Join to a purge list on all of our reports.

Here is my total select expert statement:

{V_CONSUMER_PROGRAM.INSTANCE_START_DATE} <= {?Stop Date} and
(isNull({V_CONSUMER_PROGRAM.INSTANCE_STOP_DATE}) or  {V_CONSUMER_PROGRAM.INSTANCE_STOP_DATE} >= {?Start Date}) and
{@rise program} and
isNull({PURGE_LIST.CONSUMER_ID})

//the {@rise program} points to a formula that culls out a program that we needed to track for the first part of 2011, but doesn't count towards any year end numbers.

// the "isNull ({PURGE_LIST.CONSUMER_ID}) line is the only reference to that particular table.

I'll play with it based on your suggestions.

Thanks!

Super goofy I know, but the it's the way the business runs no matter what it does to our reports!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Feb 2012 at 9:31am
also watch for NULLs in either field from the @rise program formula
({SERVICE_AREA.SERVICE_DSC},{V_CONSUMER_PROGRAM.PROGRAM_DSC})
 
if you have NULLs in this table in either of these fields they will be excluded with your <> criteria (unless you have the DB or formula to use defualt values for NULLs).
This actually might be the more likely culprit.
Also you might try moving your isNull({PURGE_LIST.CONSUMER_ID}) to the first part of yor statement.
I don't think it will make a difference in this case, but crystal wants the isnull evaluation criteria first (like in your enddate statement).


Edited by DBlank - 27 Feb 2012 at 9:33am
IP IP Logged
JCraig
Newbie
Newbie


Joined: 27 Feb 2012
Location: United States
Online Status: Offline
Posts: 6
Quote JCraig Replybullet Posted: 27 Feb 2012 at 9:35am
Update: I removed the purge list table completely and my totals changed to 2,688 vs 2,616, but when I try to exclude the one program again it changes by 264 instead of 268 like it should.

I was hoping we were on to something there with the outer join!Confused
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Feb 2012 at 9:49am
any nulls in {SERVICE_AREA.SERVICE_DSC} or {V_CONSUMER_PROGRAM.PROGRAM_DSC}
IP IP Logged
JCraig
Newbie
Newbie


Joined: 27 Feb 2012
Location: United States
Online Status: Offline
Posts: 6
Quote JCraig Replybullet Posted: 28 Feb 2012 at 4:10am
There are in {SERVICE_AREA.SERVICE_DSC} but not in {V_CONSUMER_PROGRAM.PROGRAM_DSC}


IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Feb 2012 at 4:14am
in your @rise program formula  there should be a pick list option of how to handle nulls. Change it to 'use default values for nulls' and see if that gets your missing data back.
IP IP Logged
JCraig
Newbie
Newbie


Joined: 27 Feb 2012
Location: United States
Online Status: Offline
Posts: 6
Quote JCraig Replybullet Posted: 28 Feb 2012 at 5:35am
Thanks for the continued feedback DBlank,

My @rise program formula should be taking care of it already with the first part (in bold):
if (isNull({V_CONSUMER_PROGRAM.PROGRAM_AREA_DSC})) then
    True

else if ({V_CONSUMER_PROGRAM.PROGRAM_AREA_DSC} = "Non-Rise") then
    False
else
    True

This formula correctly subtracts the 35 records that are in a "Non-Rise" program and if I take this formula out of the select expert the totals change correctly.

I tried to create another formula written like this one for my program I'm trying to subtract, but perhaps I switched things around by mistake. I'll try swapping the fields out with Program_DSC and see what happens!

Thanks again, I really appreciate the help!
IP IP Logged
JCraig
Newbie
Newbie


Joined: 27 Feb 2012
Location: United States
Online Status: Offline
Posts: 6
Quote JCraig Replybullet Posted: 28 Feb 2012 at 5:43am
Well, I tried:
if (isNull({V_CONSUMER_PROGRAM.PROGRAM_DSC})) then
    True
else if ({V_CONSUMER_PROGRAM.PROGRAM_DSC} = "MFIP - S") then
    False
else
    True

but it gave me the same result: 264 difference instead of 268.

I do have "Convert Other NULL Values to Default" checked under File --> Report Options. Would having that AND the if isnull then true lines in my formulas be causing a problem?
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