Expression to filter Date

Stimulsoft Reports.NET discussion
Post Reply
Bisoux
Posts: 16
Joined: Wed Jul 08, 2020 12:30 pm

Expression to filter Date

Post by Bisoux »

Hi,

I have two date variables. One is FromDate & the other is ToDate. So based on the user selection i want to use this expression to filter. The variables FromDate & ToDate are attached to a datasource from where they get data. The user can edit this and submit. I have added the below as a filter to my databand and my chart,

Code: Select all

Reports_Employee_AnniversaryCopy.startDate >= FromDate && Reports_Employee_AnniversaryCopy.startDate <= ToDate
When i select the desired date values there are no values returned and the graph & the databand are empty. I know for a fact there is data in the database that fulfillls the criteria I am selecting but I am not sure about my filter expression. I need your help to make sure it is correct.

The data is retreived from a mysql database & the column is a dateTime datatype.

Image[/img]

So the issue is that when the user selects the date it comes with the time. Is there a way to remove the time part in an expression ?

With Thanks
Attachments
Capture.PNG
Capture.PNG (2.51 KiB) Viewed 2586 times
Last edited by Bisoux on Mon Jul 13, 2020 8:36 am, edited 2 times in total.
Bisoux
Posts: 16
Joined: Wed Jul 08, 2020 12:30 pm

Re: Expression to filter Date

Post by Bisoux »

Really? No one can help on this ??
Andrew
Posts: 4104
Joined: Fri Jun 09, 2006 3:58 am

Re: Expression to filter Date

Post by Andrew »

Hello,

1 We have made a similar example and everything is Ok, no issues found. Our expression is like this
Orders.OrderDate >= FromDate && Orders.OrderDate <= ToDate

2 You can use the data transformation and date functions to change your datetime data.

Thank you.
Bisoux
Posts: 16
Joined: Wed Jul 08, 2020 12:30 pm

Re: Expression to filter Date

Post by Bisoux »

Hi Andrew,

Thanks for the reply. In my database the date is in the format "dd-mm-yyyy". Please let me know if the below filter is correct.

Code: Select all

Format("{0:dd.MM.yyyy}", Reports_Employee_AnniversaryCopy.startDate) >= FromDate && 
Format("{0:dd.MM.yyyy}", Reports_Employee_AnniversaryCopy.startDate) <= ToDate
Bisoux
Posts: 16
Joined: Wed Jul 08, 2020 12:30 pm

Re: Expression to filter Date

Post by Bisoux »

So I did the below,

Code: Select all

Reports_Employee_AnniversaryCopy.startDate >= Format("{0:dd-MM-yyyy}",FromDate)
That is I want to get all records that are greater than and equal to the date selected but I am getting the attached error,
Problem when parsing Chart Expression = Reports_Employee_AnniversaryCopy.startDate >= Format("{0:dd-MM-yyyy}",FromDate) value
Image
Attachments
Capture.PNG
Capture.PNG (9.34 KiB) Viewed 2544 times
Andrew
Posts: 4104
Joined: Fri Jun 09, 2006 3:58 am

Re: Expression to filter Date

Post by Andrew »

Hello,

Please, send us your report with data either support@stimulsoft.com (if this is a sencitive data) or upload it here (if this is a test data).
To embed all data in a report, select the command Embed all data to resources from the Action menu in a dictionary.

Thank you.
Post Reply