Select to view content in your preferred language

BasicFeatureLayer.Select() gives error "This operation is not supported by this implementation"

665
1
Jump to solution
04-06-2022 01:24 AM
kirken
by
Occasional Contributor

I'm using QueryTable to get data from .sde geodatabase and from the restulted table I create FeatureLayer (LayerFactory.Instance.CreateFeatureLayer()). Then I try to select records from that layer using BasicFeatureLayer.Select() / Select(qf) but always get an error "This operation is not supported by this implementation". The documentation says "Selections against QueryTables are not supported on enterprise geodatabases", does this mean that there's no way to select records from QueryTable / virtual table added to the map or is there any workaround? Then again, I am able to select features manually in ArcGIS Pro GUI. 

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

Have you tried Query Layers? The description of the query layers is on the same page as your QueryTable link. Just below few lines. Code is very similar. Example below is from ArcGIS Pro SDK samples:

    private void MakeQueryLayer(string commaSeparatedFields, Table leftTable, Table rightTable)
    {
      string fields = string.IsNullOrEmpty(commaSeparatedFields) ? "*" : commaSeparatedFields;
      var database = leftTable.GetDatastore() as Database;
      var joinClause = IsLeftOuterJoin
        ? $"{leftTable.GetName()} LEFT OUTER JOIN {rightTable.GetName()} ON {leftTable.GetName()}.{_leftField.Name} = {rightTable.GetName()}.{_rightField.Name}"
        : $"{leftTable.GetName()} INNER JOIN {rightTable.GetName()} ON {leftTable.GetName()}.{_leftField.Name} = {rightTable.GetName()}.{_rightField.Name}";
      var queryDescription = database.GetQueryDescription($"SELECT {fields} FROM {joinClause}", LayerName);
      var table = database.OpenTable(queryDescription);
      LayerFactory.Instance.CreateFeatureLayer(table as FeatureClass, MapView.Active.Map, 0, LayerName);
    }

All sample code here:

https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Geodatabase/DynamicJoins 

View solution in original post

1 Reply
GKmieliauskas
Esri Regular Contributor

Hi,

Have you tried Query Layers? The description of the query layers is on the same page as your QueryTable link. Just below few lines. Code is very similar. Example below is from ArcGIS Pro SDK samples:

    private void MakeQueryLayer(string commaSeparatedFields, Table leftTable, Table rightTable)
    {
      string fields = string.IsNullOrEmpty(commaSeparatedFields) ? "*" : commaSeparatedFields;
      var database = leftTable.GetDatastore() as Database;
      var joinClause = IsLeftOuterJoin
        ? $"{leftTable.GetName()} LEFT OUTER JOIN {rightTable.GetName()} ON {leftTable.GetName()}.{_leftField.Name} = {rightTable.GetName()}.{_rightField.Name}"
        : $"{leftTable.GetName()} INNER JOIN {rightTable.GetName()} ON {leftTable.GetName()}.{_leftField.Name} = {rightTable.GetName()}.{_rightField.Name}";
      var queryDescription = database.GetQueryDescription($"SELECT {fields} FROM {joinClause}", LayerName);
      var table = database.OpenTable(queryDescription);
      LayerFactory.Instance.CreateFeatureLayer(table as FeatureClass, MapView.Active.Map, 0, LayerName);
    }

All sample code here:

https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Geodatabase/DynamicJoins