Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Crystal Reports with Multiple Values

Crystal Reports with Multiple Values

Scheduled Pinned Locked Moved C#
databasealgorithmsbusinesssaleshelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dbetting
    wrote on last edited by
    #1

    I've been trying to find a solution to this problem. Searching here, Business Objects and several other sites, I'm finding many requests outlining the same problem but in none have I found an answer to it. Given the programatic declaration of a Crystal Report as defined below, it works great in all reports except when I need to use a variable that has to accept multiple values such as prmStatusCodes. With this parameter, the user identifies with check boxes the status' of orders they wish to view. rptCustomerSummary newRpt = new rptCustomerSummary();
    CrystalDecisions.CrystalReports.Engine.ReportDocument rptDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
    rptDocument.Load(ReportsPath+"rptCustomerSummary.rpt");
    crViewer.ShowGotoPageButton = true;
    crViewer.ShowPageNavigateButtons = true;

    CrystalDecisions.Shared.TableLogOnInfo rptLogin = new CrystalDecisions.Shared.TableLogOnInfo();
    foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in newRpt.Database.Tables)
    {
    rptLogin = tbl.LogOnInfo;
    rptLogin.ConnectionInfo.ServerName = dbServer;
    rptLogin.ConnectionInfo.UserID = dbReportLoginName;
    rptLogin.ConnectionInfo.Password = dbReportLoginPwd;
    tbl.ApplyLogOnInfo(rptLogin);
    }

    /* Customer Id Parameter */
    currParamValue = new ParameterValues();
    paramValue = new ParameterDiscreteValue();
    paramValue.Value = CompanyId.ToString();
    currParamValue.Add(paramValue);
    paramFieldDefs = newRpt.DataDefinition.ParameterFields;
    paramFieldDef = paramFieldDefs["prmCustomerId"];
    paramFieldDef.ApplyCurrentValues(currParamValue);

    /* Selected Status Options */
    currParamValue = new ParameterValues();
    paramValue = new CrystalDecisions.Shared.ParameterDiscreteValue();
    foreach (int i in ReportOptionIntAry)
    {
    paramValue.Value = ReportOptionIntAry[i].ToString();
    currParamValue.Add(paramValue);
    }
    paramFieldDefs = newRpt.DataDefinition.ParameterFields;
    paramFieldDef = paramFieldDefs["prmStatusCodes"];
    paramFieldDef.ApplyCurrentValues(currParamValue);

    crViewer.ReportSource = newRpt;In Crystal Reports, I've defined the parameter prmStatusCodes as a Discrete of type Number and Allow Multiple Values. In the report Select Expert I have

    RPT_CUSTOMER_SUMMARY_V.CUSTOMER_ID} = {?prmCustomerId} and
    {RPT_CUSTOMER_SUMMARY_V.STATUS_ID} in {?prmStatusCodes}

    In the report, if I change {?prmStatusCodes} to [5, 7

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups