0
votes

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();
1
what is ""Dr." Else "Cr.""? explain moreKF2
i set when opbal <0 it is Debit display otherwise Credit display.Mitesh Machhi
r u using if {Command.opbal}<0 then 0 else {Command.opbal} in other formula...?Asif
yes sir. i use this same formula with another formula field name.Mitesh Machhi
"opbal" is a field and of which type?Asif

1 Answers

0
votes

Is it just a typo? Your select query is returning crbal and your formula field refers to opbal?