Pass value to specify formula in Crystal Report

Posted on 2004-11-07
Last Modified: 2012-06-27

I used Crystal Report 9.2 to design a a file name called :"test.rpt".

I code in VC++(or VB), how can i pass (in VC++) a value to specify formula in Crystal Report.

thanks advance.
Question by:blueadmin
    LVL 100

    Accepted Solution

    I don't have my samples available but the basic idea is

    crRpt.Formulas(1).text = "The formula you want"

    LVL 10

    Assisted Solution

    Here is how I do it. You get a refrence to the formula field and chnage the text property. Written in C#


    private void ChangeGroupName(CrystalDecisions.CrystalReports.Engine.ReportDocument MyReport, string strGroupName)
                      //change the group name for fieldday reports
                      foreach(CrystalDecisions.CrystalReports.Engine.FormulaFieldDefinition crField in MyReport.DataDefinition.FormulaFields)
                            //start changing the header of the chart according to the group name passed
                            if (crField.Name  == "GroupField")
                                        case "client":
                                              crField.Text = "{uspReport_DaysWorked_View." + strGroupName + "}";
                                        case "rep_name":
                                              crField.Text = "{uspReport_DaysWorked_View." + strGroupName + "}";
                                        case "state_name":
                                              crField.Text = "{uspReport_DaysWorked_View." + strGroupName + "}";
                                              crField.Text = "{uspReport_DaysWorked_View." + strGroupName + "}";

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
    Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now