Print Page | Close Window

A record select formula

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=20694
Printed Date: 29 Apr 2024 at 6:28pm


Topic: A record select formula
Posted By: bremen
Subject: A record select formula
Date Posted: 30 Apr 2014 at 7:57am
I am writing a report to show some purchasing data.

There are a few instances where we purchase services as well as good from a vendor.  When we create this type of purchase order there are two lines to distinguish a purchase of goods and a purchase for services.  In my database these are considered a purchase type of 1 and 2 respectively. 

I am looking for a way that will limit my report to only show me purchase orders that contain both a purchase type of and and 2 and show me both lines on that purchase order. 

is that clear as mud? 



Replies:
Posted By: DBlank
Date Posted: 30 Apr 2014 at 8:29am
if you can use a stored proc that would be one way.
if you want to write a command that would be another.
 
For a crystal solution you can group on the purchase order number
set a min and max summary of the purchase type on that group and use that as a group select criteria
e.g.
minimum(type,PO#)= 1 and maximum(type,PO#)=2


Posted By: bremen
Date Posted: 01 May 2014 at 1:11am
Thank you. 

I also need to add one more criteria to this.  If I wanted to limit to particular type of service.... lets say office cleaning (which has a key of 4 in my DB) how would i encompass this to the with the above formula and still achieve the same result of showing both lines of the purchase order? 


Posted By: DBlank
Date Posted: 01 May 2014 at 3:56am

if you want to see all of the PO then you need another group criteria.

Create a 'flag' formula for the group
if table.type=4 then 1 else 0
now us that in the gorup criteria
sum(flag,PO#)>0
 
If you want to only see the ofice cleaning rows in the PO then you can use a record selection
table.type=4


Posted By: bremen
Date Posted: 01 May 2014 at 5:23am
Awesome. 

thank so much for the help




Print Page | Close Window