Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

20.05 Understanding the RAS Classes

Understanding the RAS Classes

Using the RAS SDK requires having an understanding of a variety of report classes and their methods. But the hardest part can be figuring out where to find them within the object model. Looking at the help files can create even more confusion because none of the examples have the class namespaces defined. In theory, this is acceptable because if you reference every RAS DLL available and import every namespace, then you’ll be covered. But doing this can be wasteful, and if you wish to use any classes from the Crystal Reports Basic library, there will errors with naming conflicts. Not knowing the namespaces makes these problems very difficult to resolve.

The class you will use with every project is the ClientDoc class. This is because it is where the ReportClientDocument class is located. The ReportClientDocument class gives you access to all the other methods and properties you’ll be using. In other words, it is the RAS equivalent to the ReportDocument class in the .NET SDK.

The ReportDefModel defines all the report objects. This includes all the areas and sections of a report as well as all the reort objects that are displayed within those sections. Basically, everything that appears within the Design tab is managed by the ReportDefModel class.

DateDefModel defines the classes that work with a report’s data source. This includes the tables and fields available to the report. It’s important to note that even if a field isn’t used on the report, it is still managed by the DataDefModel class. This gives you the ability to add new fields to the report. Basically, all the database tables and fields listed in the Field Explorer window are here.

The code listings in this book always state the complete namespace for a class so that you don’thave to guess how to reference it. Of course, this is only necessary for training purposes. Having an Imports statement (using in C#) in your own project will make your code shorting and more readable.