I need to read a field's values from a Feature Class specifically it is a Feature Class in an enterprise geodatabase. The values will be populated as a Search Box suggestion source.
I can do that by creating a FeatureLayer via
LayerFactory.Instance.CreateFeatureLayer
and using RowCursor
using (ArcGIS.Core.Data.Table ProposedBoundariesTable = FLayer.GetTable())
{
using (RowCursor rowCursor = ProposedBoundariesTable.Search())
{
//collect the information
}
}
However, in some cases, I want end-users would be able to do make a quick search without creating a Feature Layer or project item. Is there a way to do that in ArcGIS Pro SDK?
Solved! Go to Solution.
@Amadeus111 Can you open the row cursor as below as described in snippets
// Open a featureClass (within a feature dataset or outside a feature dataset). using (FeatureClass featureClass = geodatabase.OpenDataset<FeatureClass>("FeatureClassName")) using (RowCursor rowCursor = featureClass .Search(new QueryFilter())){
}
@Amadeus111 Can you open the row cursor as below as described in snippets
// Open a featureClass (within a feature dataset or outside a feature dataset). using (FeatureClass featureClass = geodatabase.OpenDataset<FeatureClass>("FeatureClassName")) using (RowCursor rowCursor = featureClass .Search(new QueryFilter())){
}
@Aashis Yes, I can. Thanks, I have been looking for this for a long time.
You can find documentation on how to open an enterprise geodatabase here:
ProConcepts Geodatabase · ArcGIS/arcgis-pro-sdk Wiki (github.com)
and documentation on how to access feature class data here:
ProConcepts Geodatabase · ArcGIS/arcgis-pro-sdk Wiki (github.com)
@Wolf Thank you for your reply but those links are broken on my end.
I used @Aashis link and worked fine. I appreciate your help though.
https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#geodatabases-and-datastores
Glad you found a solution, sorry, my links pointed to a private repo, i fixed them.