I've written many crystal reports I have them them running through my ASP.net 2.0 website (c#). The non-parameter reports work great but I'm having trouble with the parameter reports. I know I can pass the report the parameters but I don't want to do that
(much extra logic in the backend to figure out what i'm passing, date, vendor, client, inventory item ect ect).
When I run my parametered reports, it prompts me for the parameters but when I click on the button to select my dates it comes up with a ton of errors. Can I get your thoughts on running parameters this way,
Tim
Hi tbraga, I think I have the answer for your problem dude. You said you want to pass a date parameter I can give you some solution I suppose:
--First, If you want your report by default showing the date that you want, you can use "Record Selection Formula Editor" you can find it in right click in the blank space of your report then choose Report>>Edit Selection Formula>>Records...
After that you can put this formula:
{Table1.DateShipments} = #27/12/2007# or if your field database isn't a datetime type you can use: Date({Table1.DateShipments}) = #27/12/2007#
Or if you want to give a date range write this down {Table1.DateShipments} >= #27/12/2007# and {Table1.DateShipments} <= #1/1/2008#
--Secondly, if you want to pass the parameter from the webform, well let say you have a datetime picker and when you choose the date you pass the date to a textbox and click the submit button, you can use this:
Hi,
I am having a strange problem in Crystal report 2008. Earlier I was using VS 2005 Crystal report. Then we purchased Crystal report 2008.
When I open the VS 2005 projects it asks the reports to convert into Crystal report 2008. I did that.
Earlier I was using the following syntax for passing the date as selectionFormula
Dim selectionFormula As String = "{tblClient.Name} = '" & ddlClient.SelectedItem.Text & "' and {TBILL_File_Format.Week Ending Date} = #" _& Convert.ToDateTime(DtCtrlProDateFrom.DateTimeValue) & "#” WeeklyReportByClientNameReport.DataDefinition.RecordSelectionFormula
= selectionFormula
But now when I run this same it says
This field name is not known. Details: errorkind Error in the file rptWeeklyReport.rpt: Error in formula Record_selection:
‘{tblClient.Name} = 'ABC10' and "{TBILL_File_Format.Week Ending Date} = #04/20/2008#’ This field name is not known. Details: errorkind
I have no idea about this
Even If I tried to pass as follows
selectionFormula = "{TBILL_File_Format.Week Ending Date} = DateTime (2008, 04, 25, 00, 00, 00) and {TBILL_File_Format.Client Code} = 'ABC10' "
I couldn’t see any record on the report except Grouptree of the report. If I export the report it has all the data as I expected.
Member
14 Points
134 Posts
Crystal Reports, Date Parameter
Feb 13, 2008 03:36 PM|tbraga|LINK
Hi All,
I've written many crystal reports I have them them running through my ASP.net 2.0 website (c#). The non-parameter reports work great but I'm having trouble with the parameter reports. I know I can pass the report the parameters but I don't want to do that (much extra logic in the backend to figure out what i'm passing, date, vendor, client, inventory item ect ect).
When I run my parametered reports, it prompts me for the parameters but when I click on the button to select my dates it comes up with a ton of errors. Can I get your thoughts on running parameters this way,
Tim
parameters crystal
Member
68 Points
130 Posts
Re: Crystal Reports, Date Parameter
Feb 13, 2008 09:29 PM|ryan_r|LINK
Hi tbraga, I think I have the answer for your problem dude. You said you want to pass a date parameter I can give you some solution I suppose:
--First, If you want your report by default showing the date that you want, you can use "Record Selection Formula Editor" you can find it in right click in the blank space of your report then choose Report>>Edit Selection Formula>>Records...
After that you can put this formula:
{Table1.DateShipments} = #27/12/2007# or if your field database isn't a datetime type you can use: Date({Table1.DateShipments}) = #27/12/2007#
Or if you want to give a date range write this down {Table1.DateShipments} >= #27/12/2007# and {Table1.DateShipments} <= #1/1/2008#
--Secondly, if you want to pass the parameter from the webform, well let say you have a datetime picker and when you choose the date you pass the date to a textbox and click the submit button, you can use this:
That code above if you want to give a range on your date parameter, if you don't you just simply put only one text box.
Good luck dude hope it helps, let me know if it's work out for you.
Regards.
--Please put Mark as Answer, if my post helps you Thanks. Good Luck.
"Vanity is my favorite sins" -- John Milton/Satan ( Al Pacino )
None
0 Points
30 Posts
Re: Crystal Reports, Date Parameter
Apr 24, 2008 09:26 AM|sarojothi|LINK
Hi,
I am having a strange problem in Crystal report 2008. Earlier I was using VS 2005 Crystal report. Then we purchased Crystal report 2008.
When I open the VS 2005 projects it asks the reports to convert into Crystal report 2008. I did that.
Earlier I was using the following syntax for passing the date as selectionFormula
Dim selectionFormula As String = "{tblClient.Name} = '" & ddlClient.SelectedItem.Text & "' and {TBILL_File_Format.Week Ending Date} = #" _& Convert.ToDateTime(DtCtrlProDateFrom.DateTimeValue) & "#” WeeklyReportByClientNameReport.DataDefinition.RecordSelectionFormula = selectionFormula
But now when I run this same it says
This field name is not known. Details: errorkind Error in the file rptWeeklyReport.rpt: Error in formula Record_selection:
‘{tblClient.Name} = 'ABC10' and "{TBILL_File_Format.Week Ending Date} = #04/20/2008#’ This field name is not known. Details: errorkind
I have no idea about this
Even If I tried to pass as follows
selectionFormula = "{TBILL_File_Format.Week Ending Date} = DateTime (2008, 04, 25, 00, 00, 00) and {TBILL_File_Format.Client Code} = 'ABC10' "
I couldn’t see any record on the report except Grouptree of the report. If I export the report it has all the data as I expected.
Please help me out on this regards.
Thanks in advance
Saravanan
Crystal Report Viewer Crystal Report ASP.NET CrystalReportViewer Crystal Reports 2008
Member
10 Points
10 Posts
Re: Crystal Reports, Date Parameter
Feb 14, 2014 01:29 AM|leveena|LINK
You should create ParameterFieldDefinitions before passing arguments
ParameterFieldDefinitions crParameterFieldDefinitions ; ParameterFieldDefinition crParameterFieldDefinition ; ParameterValues crParameterValues = new ParameterValues(); ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = textBox1.Text; crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields; crParameterFieldDefinition = crParameterFieldDefinitions["fromDate"]; crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear(); crParameterValues.Add(crParameterDiscreteValue); crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crParameterDiscreteValue.Value = textBox2.Text; crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields; crParameterFieldDefinition = crParameterFieldDefinitions["toDate"]; crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Add(crParameterDiscreteValue); crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-date-to-date.htm
lev
parameters crystal