Print Page | Close Window

Conditional Minimum

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=12327
Printed Date: 20 Apr 2025 at 10:53pm


Topic: Conditional Minimum
Posted By: peechy23
Subject: Conditional Minimum
Date Posted: 15 Feb 2011 at 7:27am
I don't know if this is the right place to post this but I was searching for a problem that I am having with a report.  I currently have a report that is grouped by Property.Id, Building.ID,Leased.ID and I want to pull the minimum newdate by leased.id where field4 equals "Yes"
 
i Tried minimum({Option.newdate},{Leased.ID}) which gives me the correct minimum date for the Leased.ID but I need to take it one step further and have it look for the minimum by where field4 equals "yes"  So the data would be as below
 
Leased.ID   NewDate        Field4
12345        10/01/2011    Yes
12345        09/01/2011    maybe
12345       08/01/2011     no
12345       12/01/2011     yes
 
I would like the data returned to b e 10/01/2011
 
Any suggestions would be greatly appreciated and if this is not the place to post these types of questions please let me know as I am new to this forum.



Replies:
Posted By: lockwelle
Date Posted: 15 Mar 2011 at 3:23am
as long as you don't place this in a group header (it won't work there) you could write a formula that would test the value.  Something like:
 
in detailsshared datetimevar amin;
 
if {table.field} < amin then amin := {table.field};
""  //hides the formula
 
in footer
shared datetimevar amin;
 
in group header
shared datetimevar amin := '12/31/2100' //reset to a high value
""//hide the reset
 
realize that you might have already found a solution
 
HTH
 


Posted By: peechy23
Date Posted: 15 Mar 2011 at 3:54am
Thank you for the response.  I was actually able to figure this out.



Print Page | Close Window