Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Help Excluding Records Post Reply Post New Topic
Author Message
Patrick A
Newbie
Newbie


Joined: 19 Mar 2007
Online Status: Offline
Posts: 15
Quote Patrick A Replybullet Topic: Help Excluding Records
    Posted: 19 Mar 2007 at 9:49am
I'm new to Crystal, more experienced in Access, and am hoping
someone can help me with a formula.
 
I have it 2/3 working, can't seem to get the last part, can't seem to find info in Help or my 3 books.

I'm using a formula that looks at the selection a user makes in a parameter field, PCode, and passes info on to filter for record selection as a variable, PCodeVar.

The firm has various PCodes. 9999 indicates a non-billable item. 10, 11, 12...100 indicate billable items.

I have the logic for selecting just the 9999's, and for selecting all records, but I don't know how to put together the logic for selecting everything except the 9999s.

 
Here's what I have so far:
 
Select {?PCode}
Case "Non-Billable":   //If the user selected the parameter "Non-Billable"
9999 //Set the PcodeVar to 9999 - only 9999's are returned.
Case "All":   //If the user selected the parameter "All"
{praccode.pcode}   //Select all of the records in the source column.
Case "Billable":   //If the user selected the parameter "Billable"
Not 9999   //Set the PcodeVar to "anything other than 9999" > error: A Boolean is required here.

Suggestions?

Thanks.

Patrick

IP IP Logged
brreid
Newbie
Newbie
Avatar

Joined: 19 Mar 2007
Online Status: Offline
Posts: 11
Quote brreid Replybullet Posted: 19 Mar 2007 at 11:31am
Hi
Go to: Report\Select Expert\New\PCcodes(or the name of the fuield\Is not 9999.
This should give you all records in that field that is not 9999
Hope this helps
Thanks for sharing the knowledge
IP IP Logged
Patrick A
Newbie
Newbie


Joined: 19 Mar 2007
Online Status: Offline
Posts: 15
Quote Patrick A Replybullet Posted: 19 Mar 2007 at 12:35pm
Thanks, but maybe I wasn't clear in my point.
 
When the user runs the report, I want them to be able to select one of these options:
All
9999
Not 9999
 
I think the method you suggest would mean the user would always get those not = to 9999. 
 
This will work if I want to create a separate report, but I don't - I want one report with three options for the user.
 
Correct?
 
Patrick
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 19 Mar 2007 at 12:56pm
I don't get what you are doing. I presume this is a formula and its results are returned to the record selection formula? If this is a true assumption, then why don't you just put the case statement into the record selection formula and not use a secondary formula? Add this to the case statement:

{praccode.pcode}<>"9999"
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Patrick A
Newbie
Newbie


Joined: 19 Mar 2007
Online Status: Offline
Posts: 15
Quote Patrick A Replybullet Posted: 19 Mar 2007 at 2:06pm
Brian,
 
Thanks, I am new to Crystal, so it is possible I am going about this the wrong way, big picture speaking...
 
I am sorting/grouping/filtering based on a Parameter Field.
 
I have 5 parameters I let the user set before the report is run:
 
Date Range Begin
Date Range End
Group by:  (1 of 5 fields)
Sort by: (1 of 5 fields)
PCode Type: (Billable, Non-Billable, All)
 
I have a formula for Group Order, a formula for Sort Order, and a formula for PCode Type.
 
So the Parameter feeds the Formula, which feeds the record selector.
 
PCode is the formula that is giving me the fits.  Adding the code you suggested returns a different error: A number is required here.
 
Select {?PCode}
Case "Non-Billable":
9999
Case "All":
{praccode.pcode}
Case "Billable":
{praccode.pcode}<>"9999"
 
Adding it without the quotes also produces the error, this time around the whole section.
 
Note: {praccode.pcode} is a Number
I'm stumped.
 
Patrick
 
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 19 Mar 2007 at 2:57pm
Yeah, I figured it was something like this. You can't do what you want to do without getting 'slightly' more advanced. I'll try to explain it, but you might be too new to get it at first. But play around with the idea to see what happens.

You are passing a formula to a record selection formula. But the record selection formula is saying something like "field = parameter". So you let the user choose specific values to put into the parameter. The problem is that the selection formula is using "=" in it and therefore you can never do a "<>" in the value.

What you need to do is go into the record selecttion wizard and clik the Selection Formula button. This lets you modify the entire record selection formula manually. You need to get rid of the part of the formula relating to {praccode.pcode} and instead replace it with an If statment that compares the value based upon this parameter. Here is a quick and dirty sample I just typed into notepad (so I doubt if it will work yet). You will have to fix it to get rid of any syntax errors, but it should give you the idea. Also, I'm making up the first part about your other selection formulas so just put in whatever you need.

If {table.somefield} IN {?DateBegin} To {?DateEnd}
AND
(
{?PCode}="Non-billable" and {praccode.pcode} = "9999"
OR
{?PCode}="Billable" and {praccode.pcode} <> "9999"
OR
{?PCode}="All"
}
Then
True



Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 19 Mar 2007 at 2:58pm
oh. you said its a number. So take out the quotes on this sample as well.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Patrick A
Newbie
Newbie


Joined: 19 Mar 2007
Online Status: Offline
Posts: 15
Quote Patrick A Replybullet Posted: 20 Mar 2007 at 10:47am
SHWEET!!
 
If {timecard.tworkdt} IN {?Report Date Range Start} To {?Report Date Range End}
AND
({?PCode}="Non-billable" and {praccode.pcode}  = 9999
OR
{?PCode}="Billable" and {praccode.pcode}  <> 9999
OR
{?PCode}="All"
)
Then
True
 
Thanks, Brian.
 
Say, does the concept of "pairing" the selection (which goes into ?PCode) and the criteria have a name?  Is is covered in a specific section of your book?  I'm hoping it was a case of me not knowing where to look because I didn't know the proper term.
 
Patrick
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 20 Mar 2007 at 11:37am
Glad it worked! There isn't a name for this that I know of, it's just something that I came up with for your circumstance. It's impossible to predict every question every person will have, so you just try to think of the most common ones to discuss. However, now that it's helped you I'm going to make a note of it in the XI book I'm about to finish. Might help more people too. 
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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.015 seconds.