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

display date range

Status
Not open for further replies.

HRHK

Programmer
Jun 5, 2005
83
US
In CR, I have users select start date and end date and build query using this date range to populate a reporting table. What I like to do is display this start date and end date in report header. How can I do this? Thanks.
 
Try:

"Date range selected " & minimum({?Daterangeparm}) & " to " maximum({?Daterangeparm})

-k
 
Are you using parameters? If so, you can display them in a text box or formual field.

This is true for all versions from 8.5 upwards. It helps to say which version.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
I am using CR 9. How can I display parameters in textbox or formula? Thanks.

I am doing following:
Case "Customer"
Dim crReportDocument As Customer
crReportDocument = New Customer
ApplyLogOnInfo(crReportDocument.Database)
ds = oReport.GetReport(strLetter, , strBeginDate, strEndDate)
With crReportDocument
.SetParameterValue("@startDate", strBeginDate)
.SetParameterValue("@endDate", strEndDate)
End With
crReportDocument.SetDataSource(ds)
CrystalReportViewer1.ReportSource = crReportDocument

 
Created StartDate and EndDate parameter fields in Field explorer and it works.
But the Enter Parameter dialog box pops up. How can the dialog box be avoided
and instead use the param that I pass?
Thanks.
 
I already gave you the formula for what you initially wanted.

Now you're asking for external code, it's unrelated to the original topic and you should start an additional post.

And you changed what you're using, the original post stated a date range, now you speak of two different parameters.

Please be spcific with your questions, and post meaningful technical information such as the software being used, not just which version of Crystal, but your development language/version. Why would a developer think that programming languages and the Crystal API used have nothing to do with the solution?

-k
 
Thanks k, got it working with formula you provided.


' Create parameter objects
Dim myParams As ParameterFields = New ParameterFields
Dim myParam As ParameterField = New ParameterField
Dim myRangeValue As ParameterRangeValue = New ParameterRangeValue
' Set the ParameterFieldName to the name of the parameter created in the Field Explorer
myParam.ParameterFieldName = "DateRange"
' Add start date
myRangeValue.StartValue = strBeginDate
myRangeValue.EndValue = strEndDate
myParam.CurrentValues.Add(myRangeValue)
myParams.Add(myParam)
' Assign the params collection to the report viewer
CrystalReportViewer1.ParameterFieldInfo = myParams
CrystalReportViewer1.ReportSource = crReportDocument
CrystalReportViewer1.Visible = True
CrystalReportViewer1.Zoom(100)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top