Click here to Skip to main content
15,904,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am 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 perfact. so please help me...

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 :
SQL
select *  from {?database}.dbo.AC_LEDGER


the main report i bind like :
                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();
so, please help me.


Thanks and Regards,
Mitesh
Posted
Updated 24-Jun-12 19:03pm
v3
Comments
Sandeep Mewara 25-Jun-12 2:55am    
Does anything named 'opbal' exists?
dimpledevani 25-Jun-12 5:29am    
There is no such column in your select query, check your query
ShaikhM 5-Jul-12 22:53pm    
Yup you are right

1 solution

hi,

please check Command.opbal field exist or not in ur dataset if exist then check the argument if it's have or not
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900