Filtering by Date

Stimulsoft Reports.NET discussion
Post Reply
AlexK
Posts: 3
Joined: Thu Dec 22, 2016 3:57 pm

Filtering by Date

Post by AlexK »

Hi,

1. I'm trying to filter data in DataBand by setting the date in format "dd.MM.yyyy", which is used in Russia.
The filter doesn't work. When I set the date in format "MM.dd.yyyy", it works fine.

I've set both (1) the report's Culture = Russian (ru-Ru), and (2) AutoLocalizationOnRun = true, still the filter doesn't work for "dd.MM.yyyy" format.

2. Also, how can I use the date in filtering expression?

Code: Select all

Activity.PlannedFinishDate >= "21.11.2016" && Activity.PlannedFinishDate <= "25.11.2016" 
The code above doesn't work, due to the error: Operator '>=' cannot be applied to operands of type 'System.DateTime' and 'string'

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Filtering by Date

Post by HighAley »

Hello.

In your expression you compare the date with a string. Do you have the data as a string? In other way you should get a error.
You should use the DateTime variable to compare the dates or use the simplified interface.

Thank you.
AlexK
Posts: 3
Joined: Thu Dec 22, 2016 3:57 pm

Re: Filtering by Date

Post by AlexK »

I've solved most of my issues. Just to inform others who will face the similar problems:

The right way of using date in filtering expressions:

Code: Select all

Activity.PlannedFinishDate >= new DateTime(2016, 11, 21)
Still, is it possible to use "dd.MM.yyyy" date format in the simplified interface?
"MM.dd.yyyy" works fine, but this format isn't conventional for our users.

Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Filtering by Date

Post by Alex K. »

Hello,

Can you please send us simple report with test data which reproduces the issue with date formatting for analysis.

Thank you.
AlexK
Posts: 3
Joined: Thu Dec 22, 2016 3:57 pm

Re: Filtering by Date

Post by AlexK »

Hi Aleksey,

There are report and source files in attachment.
The steps to reproduce my issue are in the header of the report.

Thank you.
Test.mrz
Report file
(2.1 KiB) Downloaded 391 times
Test.xlsx
Source for the report
(9.12 KiB) Downloaded 357 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Filtering by Date

Post by Alex K. »

Hello,

We couldn't reproduce this bug. Could you explain your issue in more details?

Also, please check modified report.

Thank you.
Attachments
Test.mrt
(9.77 KiB) Downloaded 284 times
Post Reply