Hi all,
With thanks to John Gravois, I've been able to pass geometry from the result of a geocoder, along with a field name, to a spatial intersection query to run against a school boundary layer.
What I'd like to do is pull the school boundary number from the corresponding field the user chooses - that is - the user chooses Grade 6 from the drop down, which means I want the value from the SCHOOL_6 field in the boundary layer I'm querying.
So I'm wondering how I should do this:
1) Do I use the SCHOOL_6 value in the outfields query parameter and pull that value, which yields this result:
additionally - how do I pull that value 416 if there is only ever 1 feature returned, but the field name could always change based on the drop-down?
or ...
2) Pull all the fields from the query layer, and select the attribute from the field that matches the value of the drop-down (ie. SCHOOL_6), and sift through the results that way. Here's what the results look like from pulling all the fields:
@
The purpose of pulling this boundary number is that it will go into the last query, which will pull all the schools belonging to that boundary number.
UPDATE: I have added the code I am working on. cc Jake Skinner
Any thoughts appreciated.
Message was edited by: Matthew Baker
Solved! Go to Solution.
you can retrieve values from a known field a couple different ways...
attributes.FIELDNAME
attributes["FIELDNAME"]
the second syntax would be better for you if you want to substitute a variable.
Hi Matthew,
It may be helpful to post the code you are working with.
Jake Skinner, added the code I'm working with.
Try the following:
qt.execute(queryBounds, function(results) { |
var resultBound;
resultBound = results.features[0].attributes;
console.log(resultBound);
});
you can retrieve values from a known field a couple different ways...
attributes.FIELDNAME
attributes["FIELDNAME"]
the second syntax would be better for you if you want to substitute a variable.
JGravois-esristaff perfecto! That works great and will let me do exactly what I need - substitute the variable from the drop-down to the result specific to the corresponding field... great stuff!!! Many thanks to both of you! cc jskinner-esristaff
anytime amigo.