Page 1 of 1

Expression to filter Date

Posted: Sun Jul 12, 2020 1:26 pm
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

Re: Expression to filter Date

Posted: Mon Jul 13, 2020 7:54 am
by Bisoux
Really? No one can help on this ??

Re: Expression to filter Date

Posted: Mon Jul 13, 2020 9:54 am
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.

Re: Expression to filter Date

Posted: Mon Jul 13, 2020 10:07 am
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

Re: Expression to filter Date

Posted: Mon Jul 13, 2020 11:01 am
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

Re: Expression to filter Date

Posted: Wed Jul 15, 2020 5:31 am
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.