How to Create Calculated Fields in a C# .NET RDL Report
Quick Start Guide | |
---|---|
What You Will Need | |
Controls Referenced | |
Tutorial Concept | Learn how to add and use calculated fields in your C# .NET RDL reports in the ActiveReports.NET Web Designer. |
Calculated fields in ActiveReports.NET allow you to create new values based on existing data in your dataset. They're great for on-the-fly calculations without needing to modify your underlying data source.
In this quick walkthrough, we will show you how to add a calculated field to your report using the ActiveReports.NET Web Designer. This functionality is also supported in the designer's desktop versions—the steps are nearly identical, but the interface will look a bit different. We will walk through the following steps:
- Open the Data Tab
- Edit the Data Set
- Add a Calculated Field
- Define Your Calculation
- Use the Field in Your Report
Ready to get started? Download ActiveReports.NET Today!
You can also follow along in the video below:
Step 1: Open the Data Tab
Start by opening your report in the designer. In the top-right corner of the interface, switch to the Data tab. This is where all of your datasets and data-bound fields are managed.
Step 2: Edit the Data Set
Next, find your dataset and click the Edit (pencil) icon beside it. This will open the dataset configuration window.
Step 3: Add a Calculated Field
Inside the dataset configuration window, look for the Calculated Fields section. Click the plus (+) icon to add a new field.
Step 4: Define Your Calculation
Now, give your calculated field a name and enter an expression that defines how the value should be calculated.
For example:
[UnitsInStock] * [UnitPrice]
This expression multiplies the number of units in stock by the unit price to calculate each item's total stock value.
Click OK to save your calculated field.
Step 5: Use the Field in Your Report
That's it! Your new calculated field is now part of the dataset. You can drag it directly into your table or any other data-bound control.
When you preview the report, you'll see the calculated values displayed as expected.
Ready to try it out? Download ActiveReports.NET Today!
Conclusion
Calculated fields are a simple but powerful way to extend your data inside ActiveReports.NET without touching the source. Whether you need to compute totals, percentages, or other custom values, this feature helps you keep your report logic clean and reusable.