Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Dynamically Add and Remove both Formula Fields and SQL Expression via C#

I found an example of how to loop through Formula Fields and SQL Expressions on a report but how do I add new ones and delete old ones through C# code?

string myName;

foreach (CrystalDecisions.CrystalReports.Engine.FormulaFieldDefinition myFormulaField in customerReport.DataDefinition.FormulaFields)


myName = myFormulaField.Name;


foreach (CrystalDecisions.CrystalReports.Engine.SQLExpressionFieldDefinition mySQLField in customerReport.DataDefinition.SQLExpressionFields)


myName = mySQLField.Name;


Not what you were looking for? View more on this topic or Ask a question