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!

?How to get params from ASP into C/R header? 1

Status
Not open for further replies.

theAbacus

Programmer
Jul 16, 2001
2
US
Hi all,

I'm running Crystal Reports 9.x from ASP's.

When the user selects a range of dates, I want to print their selections/parameters in the C/R Header.

In ASP:

session("oRpt").RecordSelectionFormula = "{employees.HireDate} >=" &
FromDate & " AND {employees.HireDate} <=" & ThruDate

and:

'...set the From date
Set session("ParamCollection") = Session("oRpt").Parameterfields
Set Param1 = session("ParamCollection").Item(1)
Call Param1.SetCurrentValue (cstr(FromDate), 12)

' ...set the Thru date
Set Param2 = session("ParamCollection").Item(2)
Call Param2.SetCurrentValue (cstr(ThruDate), 12)

The reports run absolutely fine and as expected; but how do I get the params, 'FromDate' and 'ThruDate' to print in the C/R header?

TIA...
 
The easiest way would just be to drag the parameter fields into the report header at design time. Since you're passing them, they should display fine. I usually do it with a Text object that looks like: [From: {?StartDate} to {?EndDate}].

If you don't want to do that, then you can create a formula that can be used to display whatever you want, and set its text at runtime.

For example, you can create this formula in the CR Designer:
//@HeaderText
//Empty formula at design time, but can be set at runtime
"";

Drop it into the header, and format it however you think you need to (height, width, Can Grow, etc.). At runtime, you can send the text to the formula field something like this:

session("oRpt").FormulaFields.GetItemByName("HeaderText").Text = Chr(39) & "From: " & cstr(FromDate) & " to " & cstr(ThruDate)) & Chr(39)

Yet another option would be to simply drag the Special Field 'Record Selection Formula' onto the report

-dave
 
Vidru aka Dave...

You are a saint!

I opted for the empty-formula routine.

Thank you for your time & effort.
==
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top