Passing dates as parameters
Passing dates as parameters
Hi.
I am trying to pass dates as parameters to my mySQL report. After going through the forums, I have taken these steps:
1. In the SQL query, we have to prefix an @ in the parameter. I have done this and this is my query:
Select * from visit_master, company_master where visit_master.CompanyID = company_master.CompanyID and DateOfVisit between @DateBegin and @DateEnd
2. In the DataSource dialog, I have defined 2 parameters DateBegin and DateEnd and defined their datatype as DateTime.
3. I have then declared 2 variables FromDate and ToDate. I have given their default values as 1/1/1970 0:00:00 AM.
4. I have assigned the expression values of the DateBegin and DateEnd parameters as FromDate and ToDate respectively.
5. I am passing the parameter values in the format of YYYYDDMM.
This is my hyperlink:
http://localhost/quickstart/stimulsoft/ ... d=20110601
When I run this query in my database, I get back 3 rows
Select * from visit_master, company_master where visit_master.CompanyID = company_master.CompanyID and DateOfVisit between 20110501 and 20110601
But, in the report no rows are getting returned. What could be the issue?
Thanks in advance for any help.
I am trying to pass dates as parameters to my mySQL report. After going through the forums, I have taken these steps:
1. In the SQL query, we have to prefix an @ in the parameter. I have done this and this is my query:
Select * from visit_master, company_master where visit_master.CompanyID = company_master.CompanyID and DateOfVisit between @DateBegin and @DateEnd
2. In the DataSource dialog, I have defined 2 parameters DateBegin and DateEnd and defined their datatype as DateTime.
3. I have then declared 2 variables FromDate and ToDate. I have given their default values as 1/1/1970 0:00:00 AM.
4. I have assigned the expression values of the DateBegin and DateEnd parameters as FromDate and ToDate respectively.
5. I am passing the parameter values in the format of YYYYDDMM.
This is my hyperlink:
http://localhost/quickstart/stimulsoft/ ... d=20110601
When I run this query in my database, I get back 3 rows
Select * from visit_master, company_master where visit_master.CompanyID = company_master.CompanyID and DateOfVisit between 20110501 and 20110601
But, in the report no rows are getting returned. What could be the issue?
Thanks in advance for any help.
Passing dates as parameters
Hello,
It very hard to say where your problem is located. Please show code which you use to run report and also we need see your report. You can check "SQL.Parameters from Dialog Form" sample report in Demo.exe application from standard delivery.
Thank you.
It very hard to say where your problem is located. Please show code which you use to run report and also we need see your report. You can check "SQL.Parameters from Dialog Form" sample report in Demo.exe application from standard delivery.
Thank you.
Passing dates as parameters
Dear Jan
Thanks for the prompt reply. I am not using any code. The report is directly generated through the hyperlink.
I have attached the mrt file and a small sql file. Can you please instruct me on how to show the records between 2 visit dates? In other words, I want to see a list of visits made between 01-04-2011 and 01-05-2011.
Thanks.
Thanks for the prompt reply. I am not using any code. The report is directly generated through the hyperlink.
I have attached the mrt file and a small sql file. Can you please instruct me on how to show the records between 2 visit dates? In other words, I want to see a list of visits made between 01-04-2011 and 01-05-2011.
Thanks.
- Attachments
-
- 1015.mySQLRpt2.mrt
- (11.8 KiB) Downloaded 699 times
-
[The extension sql has been deactivated and can no longer be displayed.]
Passing dates as parameters
Hello,
We have analyzed your reports and data. For Reports.Fx for PHP, there is another way to use parameters in SQL query. Please use the following query form:
We have analyzed your reports and data. For Reports.Fx for PHP, there is another way to use parameters in SQL query. Please use the following query form:
In the GET request date can be specified in the following format (yyyy/MM/dd or yyyy-MM-dd):Select * from visit_master, company_master where visit_master.CompanyID = company_master.CompanyID and DateOfVisit between {DateBegin} and {DateEnd}
Thank you.
Passing dates as parameters
Thanks it worked, Vladimir.
However, I had to enclose the dates between single quotes like this if I used / or - as the separator:
However, I had to enclose the dates between single quotes like this if I used / or - as the separator:
Only this format worked well without quotes,
Passing dates as parameters
Hello,
You can also use the yyyy-MM-dd date format, it should correctly read in the last prerelease builds of Reports.Fx for PHP.
Thank you.
You can also use the yyyy-MM-dd date format, it should correctly read in the last prerelease builds of Reports.Fx for PHP.
Thank you.
Re: Passing dates as parameters
I am facing with the same problem code is like below if anyone can help me
Select id,name,publishing_date from books where (id = {bid} or category_id = {gid} or publishing_date between '{DateBegin}' and '{DateEnd}')
it gives me this error
The error of compilation
The error of compilation is found in the 'Report' report:
The name 'DateBegin' does not exist in the current context
Select id,name,publishing_date from books where (id = {bid} or category_id = {gid} or publishing_date between '{DateBegin}' and '{DateEnd}')
it gives me this error
The error of compilation
The error of compilation is found in the 'Report' report:
The name 'DateBegin' does not exist in the current context
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: Passing dates as parameters
Hello,
Please send us a sample report with test data that reproduces the issue for analysis.
Thank you.
Please send us a sample report with test data that reproduces the issue for analysis.
Thank you.
-
- Posts: 27
- Joined: Wed Jul 22, 2020 1:11 pm
Re: Passing dates as parameters
Is this issue resolved i am also facing the same problem with date parameters
- Attachments
-
- Test login statistic Report.mrt
- (30.62 KiB) Downloaded 270 times
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: Passing dates as parameters
Hello,
Please send us a test data fro your report.
Thank you.
Please send us a test data fro your report.
Thank you.