Adding Database Fields
Since the primary purpose of a report is to display information from a data source to the user, it’s no surpise that the most common task that people want to do is add new fields to their report. RAS makes it easy to do this, but it’s not a trivial process. Adding a database field involves the following steps:
Selecting the table and field to display.
Set the font properties (optional).
Select the area and section to place the object as well as the coordinate.
Add it to the report
Not only are these steps necessary for adding a database field to the report, they are also used for many other common tasks. For example, almost anytime you add a report object to the report that displays text, numbers or a data, you should set the font properties for that object. Since these individual steps are used extensively for different use cases, I put each one in a separate method. This lets you build a library of common RAS functions that can be used on any report. Each method uses the Shared keyword (static in C#) so that it can be put into a new class and be called from anywhere in your project without instantiating a new object. The following sections will look at the individual steps in detail and at the end it will show the code listing that pulls them together to add the database field to the report.