ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Data Namespace / SQLSyntax Class / GetFunctionName Method
A constant that specifies a Datastore-dependent SQL function name.
Example

In This Topic
    GetFunctionName Method
    In This Topic
    Gets the Datastore-dependent SQL function name corresponding to sqlFunction, e.g., SQLFunction.Sum. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public string GetFunctionName( 
       SQLFunction sqlFunction
    )
    Public Function GetFunctionName( _
       ByVal sqlFunction As SQLFunction _
    ) As String

    Parameters

    sqlFunction
    A constant that specifies a Datastore-dependent SQL function name.

    Return Value

    A Datastore-dependent SQL function name.
    Exceptions
    ExceptionDescription
    sqlFunction is not a field of SQLFunction.
    A geodatabase-related exception has occurred.
    Example
    Using SQLSyntax to form platform agnostic queries
    public async Task UsingSqlSyntaxToFormPlatformAgnosticQueries()
    {
      await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
      {
        using (Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri("C:\\Data\\LocalGovernment.gdb"))))
        using (FeatureClass featureClass = geodatabase.OpenDataset<FeatureClass>("FacilitySite"))
        {
          SQLSyntax sqlSyntax = geodatabase.GetSQLSyntax();
          string substringFunctionName = sqlSyntax.GetFunctionName(SQLFunction.Substring);
          string upperFunctionName = sqlSyntax.GetFunctionName(SQLFunction.Upper);
          string substringfunction = string.Format("{0}({1}(FCODE, 1, 6)) = 'SCHOOL'", upperFunctionName, substringFunctionName);
    
          QueryFilter queryFilter = new QueryFilter
          {
            WhereClause = substringfunction
          };
          using (Selection selection = featureClass.Select(queryFilter, SelectionType.ObjectID, SelectionOption.Normal))
          {
            // work with the selection.
          }
        }
      });
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also