cancel
Showing results for 
Search instead for 
Did you mean: 

Filter reports on DateTime does not work

Former Member
0 Kudos

Hi,

Hope anybody can help.

After upgrading to Crystal Reports for .NET 4.0 (CRforVS 13_0_0.exe) from Crystal Reports for Visual Studio 2005, the reports cannot filter on datetime Types anymore from Visual Studio. The reports works fine, when parameters are entered through the "Main Report Preview", but when provide from Visual Studio it does not filter.

I have tried to use different ways to send the Start end End value to the report, but with no help. When I filter e.g. on a simple string value on a string type field sending the values works fine. I have tried changing the format of the datatime values send, but all with no luck.

The database looks like this

.....

QueueID varchar(50)

QueueStartAt DateTime

....

Filter in Report looks like this

{EM_T_STATISTICS_SOFTQUEUE.QueueStartAt} in {?StartDate] to {?EndDate]

my Code looks like this:

Dim crParameterValues As New ParameterValues

Dim crParameterDiscreteValue As New ParameterDiscreteValue

Dim crParameterFieldDefinitions As ParameterFieldDefinitions

Dim crParameterFieldDefinition As ParameterFieldDefinition

Dim objRpt As New TVSoftQueueReporter.test

'crParameterDiscreteValue.Value = Format(PeriodeStart, "yyyy-MM-dd 00:00:00")

'crParameterDiscreteValue.Value = Format(PeriodeStart, "dd-MM-yyyy 00:00:00")

crParameterDiscreteValue.Value = PeriodeStart

crParameterFieldDefinitions = objRpt.DataDefinition.ParameterFields

crParameterFieldDefinition = crParameterFieldDefinitions.Item("StartDate")

crParameterValues = crParameterFieldDefinition.CurrentValues

crParameterValues.Clear()

crParameterValues.Add(crParameterDiscreteValue)

crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

'crParameterDiscreteValue.Value = Format(PeriodeStop, "yyyy-MM-dd 23:59:59")

'crParameterDiscreteValue.Value = Format(PeriodeStop, "dd-MM-yyyy 23:59:59")

crParameterDiscreteValue.Value = PeriodeStop  

crParameterFieldDefinitions = objRpt.DataDefinition.ParameterFields  

crParameterFieldDefinition = crParameterFieldDefinitions.Item("EndDate")  

crParameterValues = crParameterFieldDefinition.CurrentValues  

crParameterValues.Clear()  

crParameterValues.Add(crParameterDiscreteValue)  

crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)  

CrystalReportViewer1.ReportSource = objRpt  

CrystalReportViewer1.Refresh()

Any idea, could this really be a bug?

Accepted Solutions (1)

Accepted Solutions (1)

former_member188030
Active Contributor
0 Kudos

Hi Keld,

Try the sample 'vbnet_web_rangeparams.zip' from below samples collection.

https://smpdl.sap-ag.de/~sapidp/012002523100006252812008E/net_web_smpl.exe

use the code and develop a new app with CR 13 references.

Also, upgrade to SP9. You are currently using base build and there have been many issues fixed till SP9.

http://scn.sap.com/docs/DOC-7824

- Bhushan

Senior Engineer

SAP Active Global Support

Follow us on Twitter

Got Enhancement ideas? Try the SAP Idea Place

Getting started and moving ahead with Crystal Reports .NET applications.

Former Member
0 Kudos

Hi Bhushan,

Thank you for you reply. I will try it, but it was actually SP9, sorry, for my typo

/Keld

Former Member
0 Kudos

Hi Bhushan,

Thank you for your link., However it is make for VS.2003. it is so old that it will not convert with out any problems in my VS.2010.

I did not have problems with the earlier versions, only this new one.

Best regards

Keld G. Hansen

former_member188030
Active Contributor
0 Kudos

Yes, the sample app was compiled with earlier version of VS.

That is why I have suggested to use the code and develop a new app with new VS and CR 13 references. The app may be old but the code is still the same.

Thanks,

Bhushan

Former Member
0 Kudos

Hi Bhushan,

I tried the code with no luck. I even changed to removing the DataTime paramers to just use a simple string value with an Equal to function. Surprisingly it did not work!

I tried several ways to set the parameters with no luck at all. I then tried to make  a new report just filtering on a String value with an Equal to Function. And that worked. Then I removed the parameter from the Selection and deleted the parameter, then I created a parameter with exactly the same name and added it as a filter.

The I got the problem it will not use a parameter passed!

Here is a picture showing the code and the value is there runtime.

Any Ideas?

Best regards

Keld

Answers (1)

Answers (1)

Former Member
0 Kudos

No body has anything on this?