I'm making a sub report in Crystal Report using coding.One error come in Formula field that I can not understand because of all the things are perfect.
Formula Field:
if {Command.opbal}<0 then "Dr." Else "Cr."
error like : This field name is not known. Error in File C:\Users\user\AppData\Local\Temp\Debtors_Total_Outstanding_Report {A682B99D-A38B-43F3-BB05-63C258E9E0E2}.rpt: Error in formula . 'if {Command.opbal}<0 then 0 else {Command.opbal}' This field name is not known.
when click on Report.
i use command button like:
select * from {?database}.dbo.AC_LEDGER
string str = "select crbal*-1 as crbal, glname, glcode,contprsn, refby, glphone1, glcity, glphone2, email, crlimit, restorddueamt from glmast WHERE drgroup='A3402' and crbal<>0 and glcode in(" + strSelection + ")";
SqlDataAdapter ad = new SqlDataAdapter(str, con2);
DataSet ds = new DataSet();
ad.Fill(ds);
path = Server.MapPath("Debtors_Total_Outstanding_Report.Rpt");
cr = new ReportDocument();
cr.Load(path);
cr.SetDataSource(ds.Tables[0]);
cr.SetParameterValue(0,ds.Tables[0].Rows[0][1].ToString());
cr.SetParameterValue(1,company_name);
cr.SetParameterValue(2, database_name);
CrystalReportViewer1.ReportSource = cr;
CrystalReportViewer1.DataBind();