locked
how tocreate monthwise crystal reports. RRS feed

  • Question

  • User-1608433267 posted

    hello all,

    i am going to use crystal reports for my ticket system application.so i want to show the monthwise report,how can i do with this.means  i can  only enter the month name then all ticket in that particular month will be displayed.pls help me.

    thnx.

    Wednesday, May 9, 2012 5:28 AM

Answers

  • User-1608433267 posted

    Solved myself..

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 10, 2012 11:40 PM

All replies

  • User-1965752605 posted

    when you call rpt from code behind, you have to create instance of the rpt file, so give it the selectionformula

    so here is a example,

     

    Dim crDOC As New rptticketsystem

    crDoc.RecordSelectionFormula = "month({tablename.ColumnName}) = " & intMO & " AND year({tablename.ColumnName}) = " & intYR

    here intMO will contain numeric value for ex for May it will be 5

    and intYR will contain 2012

     

    Wednesday, May 9, 2012 5:39 AM
  • User-1608433267 posted

    not getting..

    Wednesday, May 9, 2012 5:47 AM
  • User-1965752605 posted

    have you called the crystal report from asp.net if yes then post the code

     

    Wednesday, May 9, 2012 5:51 AM
  • User-1608433267 posted

    see,i am created a crystal reports in that detail are tktid,severityname,statusname,transcdate,username,discription.and taken 2 text boxes to and from date.so i want when clik show button then all these details with entered date.what i do chnages in below code.pls help.

     protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack) CrystalReportViewer1.Visible = true;
            else
                CrystalReportViewer1.Visible = false;
        }
        protected void btnreport_Click(object sender, EventArgs e)
        {
            //Create report document
            ReportDocument crystalReport = new ReportDocument();
    
            //Load crystal report made in design view
            crystalReport.Load(Server.MapPath("CrystalReport.rpt"));
    
            //Provide parameter values
            crystalReport.SetParameterValue("Ticket Date", txtfromdate);
            crystalReport.SetParameterValue("Ticket Date",txttodate);
            CrystalReportViewer1.ReportSource = crystalReport;
        }

    Wednesday, May 9, 2012 6:06 AM
  • User-1965752605 posted

    ok so you want to display the reports months wise for example like below

     

    April

             tktid        severityname           statusname            transcdate              username             description

               1                  --                             --

               2

     

    May

             tktid        severityname           statusname            transcdate              username             description

               1                  --                             --

               2                  --

               3                  --

               4                  --

    if this is the case then follow this article http://myvsdotnetstuff.blogspot.in/2011/03/groups-in-crystal-report-tutorial-part.html

    you have to insert a group using group expert and use the date field on which you have to perform grouping

    in the article it has given step by step how to add group and display fields

      

    Wednesday, May 9, 2012 6:23 AM
  • User-1608433267 posted

    in that article,it only shows how to take 3 tables.i am done with this i want when i cilck from the downlist particular month then only these month record will be shown.for ex.if i click on may then the may record displayed..

    Wednesday, May 9, 2012 6:35 AM
  • User-1965752605 posted

    crystalReport.RecordSelectionFormula = "month({tablename.ColumnName}) = " & intMO & " AND year({tablename.ColumnName}) = " & intYR

    here intMO will contain numeric value for ex for May it will be 5

    and intYR will contain 2012

    Wednesday, May 9, 2012 6:54 AM
  • User-1608433267 posted

    taken a parameterfeild ticket date in that what formula i use?for ex.is equal to,in between,in periods?pls help.

    Wednesday, May 9, 2012 7:37 AM
  • User-1965752605 posted

    dont use any parameter field for that

    insert this line

    crystalReport.RecordSelectionFormula = "month({tablename.ColumnName}) = 5 "

    after

    crystalReport.Load(Server.MapPath("CrystalReport.rpt"));

    tablename is your tablename

    columnname means your ticket date column

    Wednesday, May 9, 2012 7:55 AM
  • User-1608433267 posted

    getting error crystalreport doesn't existing in current context..

    Thursday, May 10, 2012 1:08 AM
  • User-1965752605 posted

    if your earlier code is running

    you only have to put crystalReport.RecordSelectionFormula = "month({tablename.ColumnName}) = 5 " this line

     after crystalReport.Load(Server.MapPath("CrystalReport.rpt"));

    is your code running before

    if not have installed crystal reports

    if you ars using vs2010 then use this link to install it http://support.microsoft.com/kb/317789

    Thursday, May 10, 2012 1:44 AM
  • User-1608433267 posted

    still giving same error made following changes..and i have 2008 vs.

    protected void btnreport_Click1(object sender, EventArgs e)
        {
            ReportDocument reportdocument = new ReportDocument();
            reportdocument.Load(Server.MapPath("CrystalReport.rpt"));
            CrystalReport.RecordSelectionFormula = "month({TicketTranc.TranscDate}) = 5 "; 
            CrystalReportViewer1.ReportSource = reportdocument;
        }

    pls tell where i am getting wrong..see i am taken monthname from db and bounded to dropdownlist when i select jan.then jan.report will be shown..and taken one button btnreport writed above code on button.

    thnx.

    Thursday, May 10, 2012 2:02 AM
  • User-1608433267 posted

    Solved myself..

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 10, 2012 11:40 PM
  • User500443661 posted

    hi as per my exp

    first u pass the parameters(month). then crystal reports selection formula(Crystalreports -->selection formula -->records)

    write the formula.

    table.month={parametername}.

    This may be help u. if any queries tell me.

    thank u

    Monday, June 10, 2013 6:10 AM