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

Formula within a Parameter? 1

Status
Not open for further replies.

PAULCALLAGHAN

Technical User
Sep 4, 2001
165
CA
I'm using CR XI.

I would like to create a formula for dates that is based on the current date.

For example, I want starting and ending dates based on the last full calendar year.

@start_date = Date(Year(CurrentDate)-1,1,1)
@end_date = Date(Year(CurrentDate)-1,12,31)

However, I would like to use these as default parameters and give the user the ability to over-ride them.

Is this possible? If not, can someone please provide me with ideas/hints?
 
Thank you Syn for the prompt reply! You pose a very good question. I apologize for not providing this piece of information.

The users at my company use DataLink Viewer, an excellent product. I'm not sure how this is relevant though.

The kb article you gave is good but not quite applicable to my situation. It mentions a fix to parameters that are not properly keeping the last values used.

I want to use consistently calculated default values for my parameters yet still provide the user with the option to enter different values at anytime.
 
I don't know of a way to display default dates based on a formula like yours, but you could enter defaults of "9999-09-09" for the start and end date parameters, and then in the record selection formula use:

(
if {?start} <> date(9999,09,09) then
{table.date} >= {?start} else
if {?start = date(9999,09,09) then
{table.date} >= date(year(currentdate)-1,1,1)
) and
(
if {?end} <> date(9999,09,09) then
{table.date} <= {?end} else
if {?end} = date(9999,09,09) then
{table.date} <= date(year(currentdate)-1,12,31)
)

You could enter prompt text notifying the user that if they do not select a date range, the report will automatically run for the last full year.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top