I was wondering if it is possible to change formulas of a crystal report programmatically. I want to list all formulas of a report in my web app and give the user the possibility to modify them.
Is that possible?
I was wondering if it is possible to change formulas of a crystal report programmatically. I want to list all formulas of a report in my web app and give the user the possibility to modify them.
Is that possible?
Yes, for example we use the follwoing function to change formulas:
Public Sub SetReportFormulaContents(ByRef Report As ReportDocument, ByVal FormulaName As String, ByVal FormulaContents As String)
Dim Formula As FormulaFieldDefinition = Nothing
' Get the ReportObject by name and cast it as a FieldObject
If TypeOf (Report.DataDefinition.FormulaFields.Item(FormulaName)) Is CrystalDecisions.CrystalReports.Engine.FormulaFieldDefinition Then
Formula = Report.DataDefinition.FormulaFields.Item(FormulaName)
Formula.Text = FormulaContents
End If
End Sub
using CrystalDecisions.CrystalReports.Engine;
namespace Craft
{
class Mate
{
Order_Print _r = new Order_Print();
void Preview()
{
foreach (FormulaFieldDefinition f in _r.DataDefinition.FormulaFields)
{
MessageBox.Show(f.Name);
f.Text = InputBox.Show("Input the formula for " + f.Name);
}
}
}
}