Skip to Content
avatar image
Former Member

Problem with Record selection formula using Crystal run time 13.0.20

Hi ,

I am trying to access report from print preview option with Crystal run time version 13.0.20 on .net framework 4.6.2 but Its giving me below error:

{"The ) is missing.\nDetails: errorKind\rError in File 3_1_PA_IEP 13524_18740_{6A53B444-695E-45A1-A068-2A8CAC83FEA9}.rpt:\nError in formula Record_Selection: \n'({Form.FM_Kind}=1\r'\nThe ) is missing.\nDetails: errorKind"}

When I removed comment lines from record selection formula Its working fine as expected:


({Form.FM_Kind}=1

//and {Form.FM_ID}=21436

//

)

Class code:

//load report mainreportdoc = new ReportDocument(); mainreportdoc.Load(reportobject.ReportPath); //set mainselection formula reportobject.Finalize_MainSelectionFormula(); if (mainreportdoc.RecordSelectionFormula.Length > 0) { mainreportdoc.RecordSelectionFormula = "(" + mainreportdoc.DataDefinition.RecordSelectionFormulaRaw + ")"; if (reportobject.MainSelectionFormula != null && reportobject.MainSelectionFormula != "") mainreportdoc.RecordSelectionFormula = mainreportdoc.DataDefinition.RecordSelectionFormulaRaw + " and " + reportobject.MainSelectionFormula; }

Is there any suggestion on this?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Feb 27 at 03:33 PM

    I don't know, what does this line doe:

    3.reportobject.Finalize_MainSelectionFormula();?

    Don

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 23 at 10:10 PM

    Hi Sakshi,

    It's likely due to you breaking the formula text with a comment.

    But I tested it using SP 22 and it works fine for me.

    It may be the code you are using, try this:

    // Record selection formula with comments included can only be retrieve via RAS
    //rpt.RecordSelectionFormula = "if not isnull({CUSTOMER.Customer Credit ID}) then {CUSTOMER.Customer Credit ID} = {%test} else true";
    CrystalDecisions.ReportAppServer.DataDefModel.ISCRFilter myRecordSelectionWithComments; CrystalDecisions.ReportAppServer.DataDefModel.;
    myRecordSelectionWithComments = rptClientDoc.DataDefController.DataDefinition.RecordFilter;
    if (myRecordSelectionWithComments.FreeEditingText != null)
    {
    //myRecordSelectionWithComments.FreeEditingText = rptClientDoc.DataDefController.RecordFilterController.GetFormulaText();
    btnRecordSelectionForm.Text = "\nWith Comments:\n" + myRecordSelectionWithComments.FreeEditingText.ToString();
    btnRecordSelectionForm.Update();
    btnRecordSelectionForm.AppendText("\n\n");
    btnRecordSelectionForm.Update();
    btnRecordSelectionForm.AppendText("\n\nWithout Comments:\n" + rpt.RecordSelectionFormula.ToString());
    btnRecordSelectionForm.Update();
    //myRecordSelectionWithComments.FreeEditingText = "{TStat.TArt_Cod} = \"A823/001\"";
    //rpt.RecordSelectionFormula = "{TStat.TArt_Cod} = \"A823/001\"";
    //IsRpt = false;
    }
    else
    btnRecordSelectionForm.Text = "No Record Selection formula";

    Don

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 24 at 12:00 PM

    Hi Don,

    Thanks for your help and suggestion. I have another query here which is related with above thread. While executing below code record selection formula value is always vanished after jumping into next code line.

    I am checking Record selection formula length in code line:4 then jump into inside If condition. when i come to code line 8 It's not showing any value for Record selection formula but I can see value for RecordSelectionFormulaRaw and reportobject.MainSelectionFormula.

    Why the value is vanished after code line : 4. Any suggestion?

    Record selection formula: ({Form.FM_Kind}=1)

    Code class:

    //load report

    1.mainreportdoc = new ReportDocument();

    2.mainreportdoc.Load(reportobject.ReportPath);

    //set mainselection formula

    3.reportobject.Finalize_MainSelectionFormula();

    4.if (mainreportdoc.RecordSelectionFormula.Length > 0)

    5.{

    6.mainreportdoc.DataDefinition.RecordSelectionFormula = "(" + mainreportdoc.DataDefinition.RecordSelectionFormulaRaw + ")";

    7.if (reportobject.MainSelectionFormula != null && reportobject.MainSelectionFormula != "")

    8.mainreportdoc.RecordSelectionFormula = mainreportdoc.DataDefinition.RecordSelectionFormulaRaw + " and " + reportobject.MainSelectionFormula; }

    Thanks,

    Sakshi

    Add comment
    10|10000 characters needed characters exceeded