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

How to use a Formula field as a Paramater field?

Status
Not open for further replies.

brluebke

IS-IT--Management
Jul 10, 2012
3
US
I am quite new to Crystal Reports and cannot figure out how to do something that seems so simple. Below is the formula that I have made, but I cannot figure out how to use it as a DATETIME parameter in the Report.

Here is the formula:

If isnull({TABLE1.DESIRED_SHIP_DATE})

Then

({TABLE2.DESIRED_SHIP_DATE})

Else

({TABLE1.DESIRED_SHIP_DATE})
 
brluebke,

Unless I have misunderstood, it should just be a matter of referencing your formula field in the Selection Criteria from the report. Something similar to below.

Selection Criteria
Code:
{@YourFormulaField} >= CurrentDate - 3

For more assistance, please specify what criteria (or "parameter") you would like to have executed against your formula.

Hope this helps. Cheers!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
Thanks for your help! What I am attempting to do is have the Formula be used in a "From" "To" Date Time parameter. Thus the user is prompted upon running the report to enter the date range that they would like to view data for the report.

Correct me if I am wrong but if I entered the sample you have above it would then always be limited to that specified Range (e.g. last 3 days). I am hoping it could be made customizable as sometimes users want to run the report either Monthly, Quarterly, Annually, ect.
 
brluebke,

Yes, in the above, it would only return those records where the formula had a date in the last 3 days. For what you are looking to accomplish, create a Parameter Field that looks for a Date/Time and is a "Range" Parameter. In your record selection you would then use the following:

Record Selection
Code:
{@YourFormulaField} [blue]in[/blue] {?YourParameterField}

Hope this helps, cheers!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top