Crystal Reports with Multiple Values
-
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