Resources » Code Snippets » Crystal Reports

Pass Values to Crystal Report Formula Field


Posted Date: 19-Dec-2007  Last Updated:   Category: Crystal Reports    
Author: Member Level: Gold    Points: 10






Pass values dynamically to crystal report formula field


rpt.DataDefinition.FormulaFields["Head1"].Text = "'" + Session["BRANCH_NAME"].ToString() + "'";
rpt.DataDefinition.FormulaFields["Head2"].Text = "'" + Session["ADDRESS1"].ToString() + "'";
rpt.DataDefinition.FormulaFields["Head3"].Text = "'" + head3 + "'";
rpt.DataDefinition.FormulaFields["Head4"].Text = "'" + head4 + "'";



Did you like this resource? Share it with your friends and show your love!

Responses to "Pass Values to Crystal Report Formula Field"
Author: backiyaarun    25 Feb 2010Member Level: Bronze   Points : 1
Hi...


i have receive the error as Reportviewer does not contain a defenition for data definition. is there any namespace i need to include ..



Author: Chan Lemo    26 Jun 2010Member Level: Bronze   Points : 2
You can find here a detailed help of , how to pass parameter to crystal reports.

http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-string-parameter.htm

http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-integer-parameter.htm

http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-date-parameter.htm

Tks-chan



Guest Author: Mohammad Ashraf Ali     25 Jun 2013
First Create an instance of Report Class, then access the member variable and use that variable in your main interface.

Suppose I have a report class Called ReportView(), there I declared a member variable like

public CrystalDecisions.CrystalReports.Engine.ReportDocument rptDocument;


Now in your report showing interface, create an instance of ReportView and follow:

ReportView rptView = new ReportView();
rptView.rptDocument.DataDefinition.FormulaFields["formulaName"].Text = "'" + txt.Text + "'";

Here, txt.Text is a textbox that contain a value and formulaName is a formula created in report design.



Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India