I using ArcGIS Pro sdk to make an addin that can select item in attribute table by defined objectid,
But my ArcGIS Pro always freeze after I run this code.
var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(fl => fl.Name.Contains("Electric Device")).FirstOrDefault();
QueryFilter queryFilter = new QueryFilter
{
WhereClause = "OBJECTID = 12227"
};
featureLayer.Select(queryFilter);
Solved! Go to Solution.
Hi,
Select must be called on the MCT. Use QueuedTask.Run:
await QueuedTask.Run(() =>
{
QueryFilter queryFilter = new QueryFilter
{
WhereClause = "OBJECTID = 12227"
};
featureLayer.Select(queryFilter);
});
WhereClause = "OBJECTID IN (1, 2, ....)"
or best way to use .ObjectIDs property of QueryFilter
.ObjectIDs = oids // Where oids is List<long>
Hi,
Select must be called on the MCT. Use QueuedTask.Run:
await QueuedTask.Run(() =>
{
QueryFilter queryFilter = new QueryFilter
{
WhereClause = "OBJECTID = 12227"
};
featureLayer.Select(queryFilter);
});
Thank you very much for your answer. I've created new method use your code and it work.
Maybe it freeze because I put it in using( ... ) bucket.
I have one more question
if I have to select 10000 items how can I write SQL statement for this one.
It always return message 'An invalid SQL statement was used.'
WhereClause = "OBJECTID = 1 Or OBJECTID = 137 Or ... 14355".
WhereClause = "OBJECTID IN (1, 2, ....)"
or best way to use .ObjectIDs property of QueryFilter
.ObjectIDs = oids // Where oids is List<long>
@GKmieliauskas How can we use WhereClause = "OBJECTID IN ObjectIDs" where the ObjectID collection is more than 1000 and there is a limitation in oracle sde?