Hoppa till huvudinnehållet

Count a field results in a layer

Kommentarer

1 kommentar

  • Permanently deleted user
    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:
    1. 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
    2. Use an If activity to check the value of the Attribute you're interested in
    3. In the True branch, use an Assign activity to increment a counter.
    This is not very clever or elegant but it is very obvious what it does and it will be easy to read later.

     

    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,

     

    -Malcolm

     

     
    0

Du måste logga in om du vill lämna en kommentar.