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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing dates 1

Status
Not open for further replies.

staleb

Programmer
Feb 7, 2005
45
NO
HI
I have several products: A,B,C....
their table consists of Name, Price and date
The Date tells u from when the price is efective

How would I find the efective price for any given date
entered by the user?
 
Create a parameter {?effectivedate} and then go to report->edit selection formula->record and enter:

{table.date} = {?effectivedate}

This will return only those records that match your parameter date, along with the corresponding price.

-LB
 
I dont think this will work. Then they have to enter the exact date. Bur I want them to be able to enter any date

If I have a Product A
And a table like this for the product:

Product Price Efectivedate
A 5,00 01/01/2004 (dd/mm/yyyy)
A 5,50 01/03/2004
A 6,10 01/10/2004

And if the user enters a date like: 05/05/2004
He would get the price 5,50
 
Okay, now I see. Group on {table.product} and then change the record selection formula to:

{table.date} <= {?effectivedate}

Then go to report->edit selection formula->GROUP and enter:

{table.date} = maximum({table.date},{table.product})

This will give you the most recent record that is less than or equal to the parm date, and therefore, the current price at that time.

-LB
 
Thanks!

I am impressed with the speed on replies on this forum.
Wonder why I havent used this before?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top