Sum of Attribute in Results
I have a workflow that selects features based on a reference number. In the results, there is a field (AREA_HA) that contains each feature's area (in hectares). Any ideas as to how I can get the workflow to return the total sum of the area values for these selected areas?
Thanks,
Aron
0
-
Hi Aron, I recently did something similar so I chopped this out for you. You might get an idea of how to do it from this example. Good Luck! -Kev <Activity mc:Ignorable="sap sads" x:Class="{x:Null}" sap:VirtualizedContainerService.HintSize="399,821" 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:gce="clr-namespace:Geocortex.Core.Extensions;assembly=Geocortex.Core" xmlns:gfc="clr-namespace:Geocortex.Forms.Client;assembly=Geocortex.EssentialsWpfApi" xmlns:gfci="clr-namespace:Geocortex.Forms.Client.Items;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:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:sw="clr-namespace:System.Windows;assembly=WindowsBase" xmlns:sw1="clr-namespace:System.Windows;assembly=PresentationFramework" xmlns:sw2="clr-namespace:System.Windows;assembly=PresentationCore" xmlns:swt="clr-namespace:System.Windows.Threading;assembly=WindowsBase" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Sequence sap:VirtualizedContainerService.HintSize="359,741" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces"> <Sequence.Variables> <Variable x:TypeArguments="esri:FeatureSet" Name="featureSet" /> <Variable x:TypeArguments="x:Double" Name="sum" /> </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="337,243" QueryServiceUrl="SomeQuery" Results="[featureSet]" ReturnGeometry="False" SpatialRelationship="esriSpatialRelIntersects" Where="1=1" /> <ForEach x:TypeArguments="esri:Graphic" DisplayName="ForEach<Graphic>" sap:VirtualizedContainerService.HintSize="337,208" Values="[featureSet.features]"> <ActivityAction x:TypeArguments="esri:Graphic"> <ActivityAction.Argument> <DelegateInArgument x:TypeArguments="esri:Graphic" Name="item" /> </ActivityAction.Argument> <Assign DisplayName="" sap:VirtualizedContainerService.HintSize="242,60"> <Assign.To> <OutArgument x:TypeArguments="x:Double">[sum]</OutArgument> </Assign.To> <Assign.Value> <InArgument x:TypeArguments="x:Double">[sum + Double.Parse(item.attributes("AREA_HA").ToString())]</InArgument> </Assign.Value> </Assign> </ActivityAction> </ForEach> <gwa1:Alert sap:VirtualizedContainerService.HintSize="337,86" Text="[sum.ToString()]" Title="The Sum" /> </Sequence> </Activity>0 -
Perfect, that did the trick! Thanks a bunch Kevin.
Aron
0
Please sign in to leave a comment.
Comments
2 comments