Showing results for 
Search instead for 
Did you mean: 

How to set formula field in crystal report

Former Member
0 Kudos

Hello all,

I develope the code in C#.NET and use SAP B1 2004C. I have a problem with crystal report. I have in crystal report one unbound field. This field is string type. I need in my code change value of this field to another text ex. ("test").

I use this code:

FormulaFieldDefinitions crFormula;
            FormulaFieldDefinition crFormulafieldD1;
            crFormula = crReportDocument.DataDefinition.FormulaFields;
            //FormulaFieldDefinition test;
            //bool test = crFormula.IsReadOnly;
            string error = "";
            bool isCorrect = true;
            crFormulafieldD1 = crFormula[1];            
            string ahoj = crFormulafieldD1.FormulaName;
            crFormulafieldD1.Text = " ""+OP.ToString()+"" ";
            isCorrect = crFormulafieldD1.Check(ref error);      

            // Display the error message if the syntax is incorrect.
            //if (!isCorrect) MessageBox.Show(error);

The value of the field is set, but on the report isnt it. Why not. Can you help me. Send some sample.


Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos


I've never tried to change a field of the report directly. Maybe it would solve the problem if you make a parameter field, which you can use in the formula.

You can set then the parameter field: report.SetParameterValue("NameOfParam", valueOfParam);



Answers (0)