Skip to main content

Populate attribute table based on proximity of other layer

Comments

13 comments

  • Nico Burgerhart
    Use a Query Task on a layer with the city limits and use the geometry of the point to add as input for the geometry.

     

    If this query returns features fill the field with -1 else 0.

     

     
    0
  • Denise Beckham
    Thank you for your response, Nico! That helped a lot, except I'm not sure I got the workflow right.  It always assigns 0, even if the point is within city limits. Here's a snapshot.  (theFeature is the variable for the point location.)

     

    _img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=907f2000000g00y&feoid=Body&refid=0EMf2000000kCqa" _/_img_
    0
  • Dan Giersz
    The Where parameter may be required.

     

    Try adding "1=1"
    0
  • Denise Beckham
    Thanks for the suggestion, Dan! It still doesn't work properly though.  Unless I didn't enter it right.  I also tried playing around with the if task (>= 1, or =0 and switching the assign values), but that didn't work either._img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=907f2000000g018&feoid=Body&refid=0EMf2000000kCqf" _/_img_
    0
  • Dan Giersz
    I was just looking at the worklfow I had used (based on the Citizen Service Request demo) and it looks like maybe you don't need the Where clause. Mine only had Geometry and an OutField (only "OBJECTID").

     

    Try CityLimitesGeometry.Features.Count > 0 for the condition

     

    Does 'theFeature' exist before you run the query?

     

    This is where I would start putting Alerts everywhere to double-check things exist/have values.
    0
  • Denise Beckham
    I deleted the Where clause and put OBJECTID as the out field, but it still doesn't work.  The first alert shown below is what comes up when I just have the CityLimitsGeometry variable in the text field, and the second one is CityLimitsGeometry.Count.toString.  It shows 1 for the count, so it looks like it's putting out the correct value, but it's just not assigning the proper value from the Then statement.  It still always populates the field with 0. 

     

    And yes, 'theFeature' is created earlier in the workflow.  It represents where the new point is created.  The rest of the workflow populates the other fields properly (based on user inputs).

     

    _img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=907f2000000g01I&feoid=Body&refid=0EMf2000000kCqu" _/_img_

     

    _img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=907f2000000g01I&feoid=Body&refid=0EMf2000000kCqz"_/_img_

     

    _img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=907f2000000g01I&feoid=Body&refid=0EMf2000000kCr4"_/_img_
    0
  • Dan Giersz
    So the Query task is work, that's good.

     

    That means the issue is either Condition or the Assign.
    0
  • Nico Burgerhart
    Try CityLimitsGeometry.Features.Count > 0

     

    An alternative is CityLimitsGeometry.Features.Any, this returns True or False
    0
  • Denise Beckham
    Hello Nico, I tried both of these, and they show the correct value (either a 1 or True) when I put them in the alert box, but it always assigns a 0 to the field.  I even switched the values to "Yes" and "No", and it still gives me 0...  I have the

     

    Item.Attributes("CityLimits") in the To field for both of the assign activities.  Is that missing anything? I even put an alert after the If condition and changed the text to make sure the workflow was updating in the map.

     

     
    0
  • Nico Burgerhart
    Is CityLimits the exact fieldname? What is the field type?
    0
  • Denise Beckham
    Yes, CityLimits is the exact field name.  It's a text field (50-character limit). 
    0
  • Denise Beckham
    Ok, now I feel stupid... I felt sure that I had everything right in the Query and in the If condition, so started moving the whole sequence to different parts of the workflow when I discovered that the assign box for the output of the checkbox was still  in the workflow.  I could have sworn I deleted it after I deleted the checkbox, but maybe I didn't save or something.  At any rate, I deleted it for sure this time, and it works now! Thank you so much for all of your help!
    0

Please sign in to leave a comment.