Pass value to specify formula in Crystal Report

Posted on 2004-11-07
Medium Priority
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 101

Accepted Solution

mlmcc earned 1000 total points
ID: 12524987
I don't have my samples available but the basic idea is

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

LVL 10

Assisted Solution

ebolek earned 1000 total points
ID: 12526177
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month14 days, 19 hours left to enroll

840 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