Skip to Content
author's profile photo Former Member
Former Member

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

Hi,

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());

loginInfo.ApplyInfo(rptLoad);

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();

rptLoad.SetDataSource(DIT);

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;

myParameterField.CurrentValues.Add(myDiscreteValue);

myParameterFields.Add(myParameterField);

string PARAM2= GetPARAM2();

myParameterField = new ParameterField();

myDiscreteValue = new ParameterDiscreteValue();

myParameterField.Name = "@PARAM2";

myParameterField.ParameterValueType = ParameterValueKind.NumberParameter;

myDiscreteValue.Value = Convert.ToDecimal(PARAM2);

myParameterField.CurrentValues.Add(myDiscreteValue);

myParameterFields.Add(myParameterField);

}

CRVGeneral.ReportSource = rptLoad;

CRVGeneral.ParameterFieldInfo = myParameterFields;

#endregion

Thanks,

Saima

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Apr 17, 2012 at 03:10 PM

    I only have two suggestions:

    1) Make sure you are using SP 1 for CR 10.2:

    https://smpdl.sap-ag.de/~sapidp/012002523100006007872008E/crvs05sp1.exe

    2) Contact sales and ask them for a trial version of CR 2008. Sales ph: 866-681-3435

    Please note that if SP1 does not resolve the issue, you have no choice but to see if this works in CR 2008 or Crystal Reports for Visual Studio 2010 as there are no further Service Packs planned for CR 10.2.

    - Ludek

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Ludek Uher

      Ludek,

      Version of assemblies referenced in my appliction was 10.2. originally this website was developed in VS 2.0 then upgraded to VS4.0 but CR assemblies were not upgraded. There was change in crystal report data retrieval, i needed agency from web interface and then generate report of that agency only.Previously I was using SQL Views but later it was replaced by stored procedure and agencyID was passed as parameter from ASP.Net to the CR. Here I start getting the above mentioned issue.

      According to your suggestion I have used the following version of CR:

      http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_redist_install_32bit_13_0_1.zip

      Still facing the same problem. Any suggestion?

      Regards,

      Saima

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.