Share via


SQLExpressionFieldDefinition Class

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

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

Syntax

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

Remarks

Retrieve an SQLExpressionFieldDefinition object by index or by name through the Item Property of the SQLExpressionFieldDefinitions collection.

Example

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

'Declaration

          Private Function VerifySQLExpressionFieldObjectDataSource(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 myDatabaseSQLExpressionFieldDefinition As SQLExpressionFieldDefinition = myFieldObject.DataSource
               results = (myDatabaseSQLExpressionFieldDefinition.Kind = FieldKind.SQLExpressionField) And _
                         (myDatabaseSQLExpressionFieldDefinition.ValueType = FieldValueType.StringField) And _
                         (myDatabaseSQLExpressionFieldDefinition.Name = "Last Name") And _
                         (myDatabaseSQLExpressionFieldDefinition.NumberOfBytes = 16) And _
                         (myDatabaseSQLExpressionFieldDefinition.FormulaName = "")
             End If
             VerifySQLExpressionFieldObjectDataSource = results
          End Function
          
          private bool VerifySQLExpressionFieldObjectDataSource(ReportDocument reportDocument, String reportObjectName )
          {
             bool results = false;
             ReportObject reportObject = reportDocument.ReportDefinition.ReportObjects[reportObjectName];
             if (reportObject.Kind == ReportObjectKind.FieldObject)
             {
               FieldObject fieldObject = (FieldObject)reportObject;
               SQLExpressionFieldDefinition databaseSQLExpressionFieldDefinition =
                 (SQLExpressionFieldDefinition)fieldObject.DataSource;
               results = ((databaseSQLExpressionFieldDefinition.Kind == FieldKind.SQLExpressionField) &&
                 (databaseSQLExpressionFieldDefinition.ValueType == FieldValueType.StringField) &&
                 (databaseSQLExpressionFieldDefinition.Name == "Last Name") &&
                 (databaseSQLExpressionFieldDefinition.NumberOfBytes == 16) &&
                 (databaseSQLExpressionFieldDefinition.FormulaName == ""));
             }
             return results;
          }
          

Inheritance Hierarchy

Object
   EngineObjectBase
      FieldDefinition
         SQLExpressionFieldDefinition

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also

Reference

SQLExpressionFieldDefinition Members
CrystalDecisions.CrystalReports.Engine Namespace