Share via


FieldDefinition Class

Base class providing generic properties for various kinds of field definition objects.

Namespace CrystalDecisions.CrystalReports.Engine Assembly CrystalDecisions.CrystalReports.Engine (CrystalDecisions.CrystalReports.Engine.dll)

Syntax

'Declaration
Public MustInherit Class FieldDefinition
    Inherits EngineObjectBase
    Implements IDisposable
public abstract class FieldDefinition : EngineObjectBase, IDisposable

Remarks

You can retrieve the FieldDefinition object using the following properties:

Example

This example verifies that a field's datasource contains the Last Name field from the Customer table.

'Declaration

          Private Function VerifyFieldObjectDataSource(ByVal myReportDocument As ReportDocument, ByVal reportObjectName As String) As Boolean
             Dim results As Boolean = False
             Dim myReportObject As ReportObject = myReportDocument.ReportDefinition.ReportObjects.Item(reportObjectName)
             If myReportObject.Kind = ReportObjectKind.FieldObject Then
               Dim myFieldObject As FieldObject = myReportObject
               Dim myDatabaseFieldDefinition As DatabaseFieldDefinition = myFieldObject.DataSource
               results = (myDatabaseFieldDefinition.Kind = FieldKind.DatabaseField) And _
                         (myDatabaseFieldDefinition.TableName = "Customer") And _
                         (myDatabaseFieldDefinition.ValueType = FieldValueType.StringField) And _
                         (myDatabaseFieldDefinition.Name = "Last Name") And _
                         (myDatabaseFieldDefinition.NumberOfBytes = 16) And _
                         (myDatabaseFieldDefinition.FormulaName = "")
             End If
             VerifyFieldObjectDataSource = results
          End Function
          
          private bool VerifyFieldObjectDataSource(ReportDocument reportDocument, String reportObjectName)
          {
             bool results = false;
             ReportObject reportObject = reportDocument.ReportDefinition.ReportObjects[reportObjectName];
             if (reportObject.Kind == ReportObjectKind.FieldObject)
             {
               FieldObject fieldObject = (FieldObject)reportObject;
               DatabaseFieldDefinition databaseFieldDefinition = (DatabaseFieldDefinition)fieldObject.DataSource;
               results = ((databaseFieldDefinition.Kind == FieldKind.DatabaseField) &&
                 (databaseFieldDefinition.TableName == "Customer") &&
                 (databaseFieldDefinition.ValueType == FieldValueType.StringField) &&
                 (databaseFieldDefinition.Name == "Last Name") &&
                 (databaseFieldDefinition.NumberOfBytes == 16) &&
                 (databaseFieldDefinition.FormulaName == ""));
             }
             return results;
          }
          

Inheritance Hierarchy

Object
   EngineObjectBase
      FieldDefinition

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also

Reference

FieldDefinition Members
CrystalDecisions.CrystalReports.Engine Namespace