Rounding Off formula field values In Crystal Reports using C# in ASP.Net

Last Reply 11 months ago By dharmendr

Posted 11 months ago

How to round off formula field value of crytsal report

e.g. The field value is 1549.60

I have to show the value by rounding it off i.e. 1550.

Please Help me out


Thanks in advance

Posted 11 months ago

Hi ashishk,

Right click the object that you want to format and select Format Object.

Then click on Display string formula icon and you can see the following dialog box.

Then write the below formula and click Save and Close.

CSTR(Round ({DataTable1.Freight},0),0)

Using the below article i have created an example.

Generate Crystal Reports using Strongly Typed DataSet in ASP.Net using C# and VB.Net


protected void Page_Load(object sender, EventArgs e)
    ReportDocument crystalReport = new ReportDocument();
    Customers dsCustomers = GetData("SELECT TOP 10 CustomerID,Freight FROM Orders");
    CrystalReportViewer1.ReportSource = crystalReport;

private Customers GetData(string query)
    string conString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
    SqlCommand cmd = new SqlCommand(query);
    using (SqlConnection con = new SqlConnection(conString))
        using (SqlDataAdapter sda = new SqlDataAdapter())
            cmd.Connection = con;

            sda.SelectCommand = cmd;
            using (Customers dsCustomers = new Customers())
                return dsCustomers;