Skip to Content
Former Member
Sep 23, 2013 at 10:32 AM

how can i add RecordSelectionFormulato my report


my case is i have old report (crystal 9)

i upgraded it to (crystal 13)

then i want to filter it'data at the runtime using RecordSelectionFormula

i did it and the report got the numbers of pages but the viewer does not appear any data

the problem is here

when i remove the RecordSelectionFormula it works

is that any way to resolve this issue

i use vs 2010 and this is my code:

ReportDocument reportDocument = new ReportDocument();

CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();

crystalReportViewer1.ShowGroupTreeButton = false;

TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();

TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();

ConnectionInfo crConnectionInfo = new ConnectionInfo();

Tables CrTables;

// load report

reportDocument.Load(AppDomain.CurrentDomain.BaseDirectory.ToString() + "\\Reports\\" + reportName);

// set report Parameter

if (Param_Values != null)


foreach (KeyValuePair<string, object> Param_Value in Param_Values)


reportDocument.SetParameterValue(Param_Value.Key, Param_Value.Value);



// set report Connection info

string[] LoginData = PerfectPos.Properties.Settings.Default.ConnectionString.Split(';');

if (!string.IsNullOrEmpty(LoginData[4].ToString()))


crConnectionInfo.Password = LoginData[4].Split('=')[1].ToString();


crConnectionInfo.UserID = LoginData[3].Split('=')[1].ToString();

crConnectionInfo.DatabaseName = LoginData[1].Split('=')[1];

crConnectionInfo.ServerName = LoginData[0].Split('=')[1];

CrTables = reportDocument.Database.Tables;

foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)


crtableLogoninfo = CrTable.LogOnInfo;

crtableLogoninfo.ConnectionInfo = crConnectionInfo;



DateTime dt = DateTime.Parse("08/26/2013");

string d = "{vuREPChequeDetails.IsClosed}=true and {vuREPChequeDetails.IsVoid}=false and {vuREPChequeDetails.PaymentTypeID}=1";

reportDocument.RecordSelectionFormula = d;

crystalReportViewer1.ReportSource = reportDocument;

WindowsFormsHost host = new WindowsFormsHost();

host.Child = crystalReportViewer1;



Picture1.png (169.4 kB)