Gets the
Datastore-dependent SQL function name corresponding to , e.g.,
SQLFunction.Sum. This method must be called on the MCT. Use QueuedTask.Run.
Parameters
- sqlFunction
- A constant that specifies a Datastore-dependent SQL function name.
Return Value
A
Datastore-dependent SQL function name.
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.
}
}
});
}
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.