Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Minimum Function on a Second Pass Formula 1

Status
Not open for further replies.

greengo204

Technical User
Apr 7, 2009
56
AU
I am trying to perform a minimum summary on a 2nd pass formula and not entirely sure how to go about this.

Ive previously performed Grand Totals on 2nd pass formulas by using variables & subtotals, so assume it will be a similar process.

My formula looks like:

if previous ({po_srvc_prdct.prdct_cd}) = {po_srvc_prdct.prdct_cd}
and previous({po_order_line.order_line_amnt}) = 0
and {po_order_line.order_line_amnt} > 0
then {po_order.dspch_dt}

I am trying to return the minimum date of when prices changed from £0 to > £0

Any help or alternatives would be appreciated!!

I am using Crystal Reports 8.5, Crystal Syntax
 
You would use the variable method again:

//{@init} to be placed in the report header:
whileprintingrecords;
datevar mindate := currentdate;//or some date always greater than the minimum date

//{@getmin} to be placed in the detail section:
whileprintingrecords;
datevar mindate;
if {@yourformula} < mindate then
mindate := {@yourformula} else
mindate := mindate;

//{@display} for the report footer:
whileprintingrecords;
datevar mindate;

-LB
 
IBass

worked perfect.

also used an adaption to get a maxium by using a date that would always be less when compared to any date i.e. in my case i substituted the currentdate formula for: date(1900,01,01)

Thanks
 
For max, you could also have just left the variable without a value--it would default to date(0,0,0) and always be less than any other value.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top