Skip to Content
Former Member
Apr 17, 2012 at 12:55 PM

Crystal Reports not working with stored proc and record selection formula simultaneously



I am using crystal decision of version 10.2. When I pass db parameter while loading crystal report and also use record selection formula from C#.Net it does not work and gives following error:

This field name is not known. Error in File C:\WINDOWS\TEMP\Aging Report R1_3xabq3urvmonoi0odke0xp0dr {9B5715E2-8445-45DD-B5BD-37831D6F266E}.rpt: Error in formula . '{VIEW_AGING_HISTORY.ISSUE_NUMBER} In ["1"] AND {VIEW_AGING_HISTORY.VOLUME_NUMBER} In ["24"]' This field name is not known.

I tried to remove one of them and it work fine. By hit and trial I removed complex formulas and subreports to fix this issue, I found when I remove Groups from the CR it worked with SP paramaters and record selection formula. This is a problem I need groups in my crystal reports and cannot avoid grouping. Do any body have idea what could be the actual cause and any solution to this problem.

Following is the code to load CR:

Hashtable hshtbl = DbInfo();

CrystalLoginInfo loginInfo = new CrystalLoginInfo(hshtbl["data source"].ToString(), hshtbl["initial catalog"].ToString(), hshtbl["user id"].ToString(), hshtbl["password"].ToString());


CRVGeneral.DisplayGroupTree = false;

CRVGeneral.DisplayToolbar = true;

string Datasource = rptLoad.Database.Tables[0].Name;

if (Datasource.Contains(";"))//If data source is stored proc


#region [Code added for filter loading using SP]

if (strFormula.Length > 0)


rptLoad.RecordSelectionFormula = strFormula;


DataTable DIT = new DataTable();


ParameterFields myParameterFields = new ParameterFields();

ParameterField myParameterField = new ParameterField();

ParameterDiscreteValue myDiscreteValue = new ParameterDiscreteValue();

if (rptLoad.DataDefinition.ParameterFields.Count > 0)


myParameterField.Name = "@PARAM1";

myParameterField.ParameterValueType = ParameterValueKind.NumberParameter;

myDiscreteValue.Value = PARAM1;



string PARAM2= GetPARAM2();

myParameterField = new ParameterField();

myDiscreteValue = new ParameterDiscreteValue();

myParameterField.Name = "@PARAM2";

myParameterField.ParameterValueType = ParameterValueKind.NumberParameter;

myDiscreteValue.Value = Convert.ToDecimal(PARAM2);




CRVGeneral.ReportSource = rptLoad;

CRVGeneral.ParameterFieldInfo = myParameterFields;