Zum Hauptinhalt gehen

Select features using For Each Loop

Kommentare

2 Kommentare

  • Malcolm Walker
    • Community-Manager
    Hi Hani,

     

    The Query Task activity will return a new FeatureSet object every time it runs in this loop.  It will not merge together if there are already features in the featureset.

     

    To resolve this, you could do two different things:

     

    1.  Change your WHERE clause to request all parcels at once, then do not loop the Query Task.  To do this, you would use a loop or similar function call to create a string like this:

     

    PARCELNUMBER IN ('abc', 'def', 'ghi', ... 'xyz')

     

    2.  Use a second FeatureSet variable to store your results.  In your loop, you would add a variable called featureSetComplete.  Then, using an If activity to test if featureSetComplete is Nothing, branch to activities that assign featureSetComplete the value of featureSet3 if it's nothing, otherwise use an Add Range To Collection activity to add the Features attribute of featureSet3 to the Features attribute of featureSetComplete.

     

    Note: you can only add to the Features attribute of a FeatureSet if the Graphic objects you're going to add match up with the geometry type and fields of the FeatureSet.  So, if you know you are getting these features all from the same place you will be fine.  If your Features actually come from different layers, you may not get your expected results.

     

    Regards,

     

    -Malcolm
    0
  • Permanently deleted user
    Many Thanks for the wonderful suggestion Malcolm!

     

    I went with the second one qand it worked fine!
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.