Using a QueryFilter for a Table that comes from a Feature Server

1451
3
02-19-2018 07:48 AM
KarlHuber
New Contributor III

Hi there,

we discovered a strange error message, when we tried to use a query filter in combination with a feature service. Our repro case is as following:

                    var geodatabase = new Geodatabase(

                         new ServiceConnectionProperties(

                             new Uri(

                            @"https://myportal.aed-sicad.de/server/rest/services/Electric_Distribution_Utility_Network/FeatureServ...")));

 

                     var table = geodatabase.OpenDataset<Table>("L1503UT_CLASSGROUPS");

                     var rowCursor = table.Search(null, true);

                     var moveNext = rowCursor.MoveNext();

this gave us the error message:

System.Runtime.InteropServices.COMException: 'Ein Ereignis konnte keinen Abonnenten aufrufen. (Ausnahme von HRESULT: 0x80040201)'

Sorry for the german text here, translation is "An event could not call a subscriber." - The HRESULT is 0x80040201

The 'Table' "L1503UT_CLASSGROUPS" refers to a standalone table that is part of the layers that are published with the feature service: Table name is "UT_CLASSGROUPS" the Layer ID is "1503". The 'Table' can be openend properly. A Table.Search(...) yields into the error above.

Our Pro-Version is 2.1.1

Thanks you for any ideas of how to resolve that...

Greetings

Karl

 

0 Kudos
3 Replies
ThomasEmge
Esri Contributor

Karl,

change your first line to 

var featureService = new FeatureService(

and the remainder stays pretty much the same.

0 Kudos
KarlHuber
New Contributor III

Hi Thomas,

thanks for your comment. Unfortunately we're not able to find a class with name "FeatureService" in the ArcGIS Pro SDK - the only class that allows me to handle calls to a datastore which is a feature service is the Geodatabase class: ArcGIS Pro 2.1 API Reference Guide 

But what we found out is, that our feature service consist out of feature classes that are commited to branch versioning and standalone tables that are not versioned at all. We can query now only datasets which are (branch) versioned. Thus means, that if you publish a feature service that contains versioned datasets you need to ensure that all dataset that are about to be queried as well are properly versioned (including Global IDs and Editor Tracking)

Thus making things a little bit tricky...

0 Kudos
ThomasEmge
Esri Contributor

Karl,

totally my mistake, unfortunately it was based on some old unreleased software.

The correct approach is like this:

GroupLayer fs = null;
await QueuedTask.Run(() => {
    fs = LayerFactory.Instance.CreateLayer(new Uri("<url_here>", UriKind.Absolute), MapView.Active.Map) as GroupLayer;
});‍‍‍‍

foreach (var fl in fs.Layers) {
// these are feature layers!
// do the search on the sublayer
}