Count a field results in a layer
I am trying to count the number of results that are the same in a specific field of a specific layer by using a workflow. The idea is that in a data set, there is a layerID that will be in a number of results in the first dataset. If i can count the number of times the unique layerID is represented in that first dataset, then i have a total of the first features that are assoceated with the second. I don't know if that makes sense, I am trying to keep out proprietary information.
0
-
Hi Slade,
There are many different ways you can do this. If you're just starting out with Workflow then I recommend doing something very straightforward and obvious:- Use a For Each activity to loop through the FeatureSet object (or its Features attribute) - the enumeration you get are for Graphic objects which have Attributes
- Use an If activity to check the value of the Attribute you're interested in
- In the True branch, use an Assign activity to increment a counter.
For something clever (though still not elegant) you can use a LINQ expression to process the featureset in one shot, buy using this in an Assign to assign an integer value:(From myGraphic in featureSet1 Where myGraphic.Attributes("Land_Use_Description").Equals("RESIDENTIAL")).Count()Replace Land_Use_Description and RESIDENTIAL with the field names and target values of your choosing.
While this does the job in one expression, it makes it much more difficult to find a problem if there are any, so go with whatever you're more comfortable with.
If you're still stuck, you can contact your support provider and we can help.
Regards,
-Malcolm0
Please sign in to leave a comment.
Comments
1 comment