Share via


SpecialVarFieldDefinition Class

Provides properties for retrieving information on a special field found in a report.

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

Syntax

'Declaration
Public Class SpecialVarFieldDefinition
    Inherits FieldDefinition
    Implements IDisposable
public class SpecialVarFieldDefinition : FieldDefinition, IDisposable

Remarks

Retrieve a FieldDefinition object through the DataSource Property of the FieldObject object and cast the FieldDefinition object as a SpecialVarFieldDefinition object.

Example

This example shows how to retrieve a SpecialVarFieldDefinition object and how to verify that a special field's datasource contains the Last Name field from the Customer table.

'Declaration

      Private Function GetSpecialField _
         (ByVal reportObjectName As String) As SpecialVarFieldDefinition
         Dim field As FieldObject
         Dim specialField As SpecialVarFieldDefinition

         If TypeOf _
            (Report.ReportDefinition.ReportObjects. _
            Item(reportObjectName)) Is FieldObject Then
            field = Report.ReportDefinition.ReportObjects. _
               Item(reportObjectName)

            If TypeOf (field.DataSource) _
               Is SpecialVarFieldDefinition Then
               specialField = field.DataSource
               GetSpecialField = specialField
            Else : GetSpecialField = Nothing
            End If
         Else : Return Nothing
         End If
      End Function

            Private Function VerifySpecialVarFieldObjectDataSource(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 myDatabaseSpecialVarFieldDefinition As SpecialVarFieldDefinition = myFieldObject.DataSource
                 results = (myDatabaseSpecialVarFieldDefinition.Kind = FieldKind.SpecialVarField) And _
                           (myDatabaseSpecialVarFieldDefinition.ValueType = FieldValueType.StringField) And _
                           (myDatabaseSpecialVarFieldDefinition.Name = "Last Name") And _
                           (myDatabaseSpecialVarFieldDefinition.NumberOfBytes = 16) And _
                           (myDatabaseSpecialVarFieldDefinition.FormulaName = "")
               End If
               VerifySpecialVarFieldObjectDataSource = results
      End Function
      
      private SpecialVarFieldDefinition GetSpecialField
         (string reportObjectName)
      {
         FieldObject field;
         SpecialVarFieldDefinition specialField;

         field =
            Report.ReportDefinition.ReportObjects[reportObjectName]
            as FieldObject;
         if (field != null)
         {
            specialField = field.DataSource as
               SpecialVarFieldDefinition;
            if(specialField != null) return specialField;
            else return null;
         }
         else return null;
      }

      private bool VerifySpecialVarFieldObjectDataSource(ReportDocument reportDocument, String reportObjectName )
      {
         bool results = false;
         ReportObject reportObject = reportDocument.ReportDefinition.ReportObjects[reportObjectName];
         if (reportObject.Kind == ReportObjectKind.FieldObject)
         {
           FieldObject fieldObject = (FieldObject)reportObject;
           SpecialVarFieldDefinition databaseSpecialVarFieldDefinition =
             (SpecialVarFieldDefinition)fieldObject.DataSource;
           results = ((databaseSpecialVarFieldDefinition.Kind == FieldKind.SpecialVarField) &&
             (databaseSpecialVarFieldDefinition.ValueType == FieldValueType.StringField) &&
             (databaseSpecialVarFieldDefinition.SpecialVarType == SpecialVarType.FileAuthor) &&
             (databaseSpecialVarFieldDefinition.Name == "Last Name") &&
             (databaseSpecialVarFieldDefinition.NumberOfBytes == 16) &&
             (databaseSpecialVarFieldDefinition.FormulaName == ""));
         }
         return results;
      }
      

Inheritance Hierarchy

Object
   EngineObjectBase
      FieldDefinition
         SpecialVarFieldDefinition

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also

Reference

SpecialVarFieldDefinition Members
CrystalDecisions.CrystalReports.Engine Namespace