Hello everyone. I am having a hard time trying to construct a statement so that the if the point drawn on the map is intersecting the feature layer to pull data from the feature layer if not to select "Not in a priority Area" from the choice field. Please help I am not knowledgeable in coding or connect
if (
within ( pulldata("@layer", "getValueAt", "attributes.Name", "https://services2.arcgis.com/sBoGufkdR7jFytOm/arcgis/rest/services/shedMap_WFL1/FeatureServer/8", ${Location_of_Project}, "")), "Not in a Priority Area"
)
Pulldata does not work well inside an if. Move it out to a temp field and then check that in the if.
Thanks for reply Doug! I wish I was able to get an auto populate if a feature does not intersect with a point.
Doug just means you need to split up the operation. You can still do what you want.
Calculate #1 is your pulldata(@layer)
E.g., pulldata("@layer", "getValueAt", "attributes.Name", "https://services2.arcgis.com/sBoGufkdR7jFytOm/arcgis/rest/services/shedMap_WFL1/FeatureServer/8", ${Location_of_Project}, "")
Calculate #2 is your IF statement.
E.g., if(${pulldata_calc}='','Not in a Priority Area',${pulldata_calc})
Not saying these calculates are correct. They are just examples. This is generally what you'd be looking to do.
Thank you for your help! I was able to get it to work. I used two calculation fields and it worked perfectly, but I ended up combining it.
Glad you got it working!
Going back to what Doug already said though, sometimes pulldata doesn't like being nested within IF() statements. If it is working for you, great. But if it starts acting odd, consider breaking it out the steps into separate calculates.
Good luck.
What if I am pulling data from a layer with polygons for a location and the point is outside the polygons boundary and in place of the polygon attribute I want to put "International" in the text field instead of the polygon attribute. I hope this makes sense. How would I do this?
Thank you!
From your description, it sounds like when you click outside of your desired polygon area, you are clicking into "nothing", and so nothing should be returned. As has been mentioned in this thread, you should be able to set up two calculates to 1) pulldata(@layer), followed by 2) an IF() statement to test whether or not any data was returned by the pulldata(@layer)