Delete Features Object IDs
is there are good way to provide the DeleteFeatures activity with the object_ids of the features selected? I need some sample code that shows how to build a list or a collection of the objectids of the selected features. maybe there is a sample out there.
J
-
Hi Jeff
try this:
<Activity mc:Ignorable="sap" x:Class="{x:Null}" sap:VirtualizedContainerService.HintSize="392,1082" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:eac="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client" xmlns:eacg="clr-namespace:ESRI.ArcGIS.Client.Geometry;assembly=ESRI.ArcGIS.Client" xmlns:eact="clr-namespace:ESRI.ArcGIS.Client.Tasks;assembly=ESRI.ArcGIS.Client" xmlns:esri="http://schemas.esri.com/arcgis/client/2009" xmlns:gfc="clr-namespace:Geocortex.Forms.Client;assembly=Geocortex.EssentialsWpfApi" xmlns:gr="clr-namespace:Geocortex.Reporting;assembly=Geocortex.Reporting" xmlns:gwa="clr-namespace:Geocortex.Workflow.Activities;assembly=Geocortex.Workflow" xmlns:gwa1="clr-namespace:Geocortex.Workflow.Activities;assembly=Geocortex.Workflow.Activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=System.Core" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=mscorlib" xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Sequence sap:VirtualizedContainerService.HintSize="352,1042" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">
<Sequence.Variables>
<Variable x:TypeArguments="scg:ICollection(x:Int32)" Name="collDelAddresses" />
<Variable x:TypeArguments="esri:FeatureSet" Name="fsAddress" />
<Variable x:TypeArguments="scg:IList(esri:EditResultItem)" Name="iListUpdateSucess" />
</Sequence.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<gwa1:QueryTask sap:VirtualizedContainerService.HintSize="330,227" Results="[fsAddress]" SpatialRelationship="esriSpatialRelIntersects" />
<gwa1:CreateCollection x:TypeArguments="x:Int32" sap:VirtualizedContainerService.HintSize="330,59" Result="[collDelAddresses]" />
<ForEach x:TypeArguments="esri:Graphic" DisplayName="ForEach<Graphic>" sap:VirtualizedContainerService.HintSize="330,407" Values="[fsAddress.Features]">
<ActivityAction x:TypeArguments="esri:Graphic">
<ActivityAction.Argument>
<DelegateInArgument x:TypeArguments="esri:Graphic" Name="item" />
</ActivityAction.Argument>
<Sequence sap:VirtualizedContainerService.HintSize="252,304">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<gwa1:CommentOut sap:VirtualizedContainerService.HintSize="225,118">
<gwa1:Alert sap:VirtualizedContainerService.HintSize="211,82" Text="[CStr(item.Attributes("OBJECTID"))]" Title="OBJECTID to be deleted" />
</gwa1:CommentOut>
<AddToCollection x:TypeArguments="x:Int32" Collection="[collDelAddresses]" sap:VirtualizedContainerService.HintSize="225,22" Item="[CInt(item.Attributes("OBJECTID"))]" />
</Sequence>
</ActivityAction>
</ForEach>
<gwa1:DeleteFeatures FeatureLayerUrl="http://featureServiceUrl" sap:VirtualizedContainerService.HintSize="330,105" ObjectIDs="[collDelAddresses]" Results="[iListUpdateSucess]" />
</Sequence>
</Activity>You will need to do a little work but you should be able to get moving.
Regards
Ralph
0 -
Ralph,
U R da man! Thanks.
0 -
Ralph--
That's exactly what we were looking for. with your help - up and going in a few minutes!! now just wire in a few more variables and we are good to go!
J
0 -
FYI. The next Essentials release will contain a GetObjectIDs activity that accepts a FeatureSet and returns a list of integers.
--Ryan
0 -
...three years later...Ryan the GetObjectIDs returns a collection of objects and delete features requires a collection of integers. 0 -
Hi Jake,
The ObjectIDs property of a FeatureSet does return an IEnumerable<object>. This is part of Esri's API.
The GetObjectIDs workflow activity returns an IList<int>.
There is also a GetAttributeValues<T> activity that will work on any field of any type and provide a list.
--Ryan0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
6 kommentarer