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

How to pass date ranges from ASP to Crystal Reports?

Status
Not open for further replies.
Oct 11, 2006
300
US
I work with CR 8.5 and ASP.

How can I work on passing a date -range with a start date and end date to the report?

I am passing a single parameter - EmpID

Set MyParam2 = session("Param").Item(2)
MyNewParamValue2 = strEmpID
Call MyParam2.SetCurrentValue(CDbl(MyNewParamValue2), 7)

And in addition, I want to pass a date range. How can I achieve this.

Thanks.
 
I write this pass date ranges, but no data shows because I am not passing any dates. Only Employee ID shows on my report.

'This line sets the DiscreetOrRangeKind to 1. For Ranged parameters the constant is 1.
session("oRpt").ParameterFields.GetItemByName("RangedDateParameter").DiscreteOrRangeKind = 1

'This line uses the AddCurrentRange method which takes three arguments.
' AddCurrentRange LowerBoundValue, UpperBoundValue, CRRangeInfoConstant
'The CRRangeInfoConstant of 3 indicates that the range should include values greater than or equal to
'the lower bound and less than or equal to the upper bound.

'Reformat the start date to that of Crystal
splitStartDate = split(strStartDate, "/")
MyStartDate = splitStartDate(2) & "/" & splitStartDate(0) & "/" & splitStartDate(1) & " 12:00:00 AM"

'Reformat the end date to that of Crystal
splitEndDate = split(strEndDate, "/")
MyEndDate = splitEndDate(2) & "/" & splitEndDate(0) & "/" & splitEndDate(1) & " 12:00:00 AM"

session("oRpt").ParameterFields.GetItemByName("RangedDateParameter").AddCurrentRange CDate(MyStartDate),CDate(MyEndDate),CDbl("3")

Please do let me if I am using the right range methods.

Thanks.
 
Have anybody worked with Date Ranges in ASP and passing them to CR 8.5?

Please do respond.

Thanks.
 
Anybody who has worked with Date Ranges?

Crystal takes a date range parameter. How to work with Date Range parameter ASP (Not ASP.Net)

Thanks.
 
Can you please assist me here:

I get these from the form in my ASP page:


Code:
'Request for the startDate
strStartDate = Request.form("StartDate")

'Request for the endDate
strEndDate = Request.form("EndDate")
In the Record Selection Formula editor, I have this:


Code:
{AMP.EmpID} = {?EmpId} and
{AMP.DateOfPost} in{?Post Date Range} and
{AMP.DateOfPost} > Date (2006,1,1)
Where AMP is the table name
and DateOfPost is the column name.

So within the ASP page, is this the way, I am supposed to write the code:


Code:
'This line creates an object to reference the 1st parameter in the report.
'{?Post Date Range}

'Passing date range to the Crystal Report Viewer.
sel ={AMP.DateOfPost}>= CDate(strStartDate) and {AMP.DateOfPost}<= CDate(strEndDate)


'EmpID which is numeric should be equal to ?EmpID. Hence cast as double of type number 7. (See the chart below)

Set MyParam3 = session("Param").Item(3)
MyNewParamValue3 = strEmpID
Call MyParam3.SetCurrentValue(CDbl(MyNewParamValue3), 7)
However the date taken by Crystal in the format of YYYY/MM/DD

For single date parameter reports, I used to do this:


Code:
Set MyParam1 = Session("Param").Item(1)
splitdate = split(Request.form("period"), "/")
MynewDate1 = splitdate(2) & "/" & splitdate(0) & "/" & splitdate(1) & " 12:00:00 AM"
MyParam1.SetCurrentValue CDate(MynewDate1)
Do I do the same for Date Ranges too?

Please do respond and mention if the above select string syntax is right or not?

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top