Select to view content in your preferred language

Get selected records from the attribute table using the SDK

338
1
Jump to solution
11-21-2024 01:18 PM
TyroneLigon1
Regular Contributor

Using ArcGIS Pro 3.2 - there's a button on the attribute table UI that allows the user to copy selected records and paste them to the clipboard. I would like to capture that record array, serialize it, and send it to an external website. I've found methods in the SDK to get the selected object IDs or row indices, but nothing after that. My guess is absent of a method that allows me to grab the selection and use it, I have to query the feature layer/table using the collected IDs/indices and put the results in an array for further use.

0 Kudos
1 Solution

Accepted Solutions
Aashis
by Esri Contributor
Esri Contributor

You can enumerate the selected records using Selection.Search()

   //Enumerate over the selected features
    using (var rc = selection.Search())
    {
      while (rc.MoveNext())
      {
        using (var feature = rc.Current as Feature)
        {
          var oid = feature.GetObjectID();
          //etc.
        }
      }
    }

View solution in original post

0 Kudos
1 Reply
Aashis
by Esri Contributor
Esri Contributor

You can enumerate the selected records using Selection.Search()

   //Enumerate over the selected features
    using (var rc = selection.Search())
    {
      while (rc.MoveNext())
      {
        using (var feature = rc.Current as Feature)
        {
          var oid = feature.GetObjectID();
          //etc.
        }
      }
    }
0 Kudos