I need to return a text value so that it can be used in Crystal Reports. The report will access the app by appending the coordinates of a known location as parameters to the app url.
I'd want the html page to return the name of the state where the given coordinates reside. The following code works in retrieving the state, I just don't know how to get it to pass an object that Crystal reports can read as text.
Here's the code that I have. Thank you for any help.
function init(){ var webParams = document.location.search; //format ?x*y //parse out info that comes after the ? XYString = webParams.substr(1).split('*'); XString = XYString[0]; YString = XYString[1];
//set xy to preset values to verify the process //Wyoming -11920113.271*5345577.536 //Wisconsin -10045094.029*5622569.015 //Alaska -17076416.186*9905283.420 //Alabama -9618953.292*3896699.031
var XY = new esri.geometry.Point(XString, YString, new esri.SpatialReference({ wkid: 102100 })); featureQuery.geometry = XY; fimStandQueryTask.execute(featureQuery, showResults); } else { showResults(null); }
}
function showResults(featureSet) {
var s = "NA"; if (featureSet != null) { if (featureSet.features.length > 0) { var featureAttributes = featureSet.features[0].attributes; for (att in featureAttributes) { s = featureAttributes[att]; } } }
//Build the appropriate data object for our data component var data = { "identifier": "StateName", "items": s }; alert(data.items); return data.items;
I greatly appreciate your reply. That sample may be helpful in providing a better way to extract the parameters, but the real concern is building an object that Crystal Reports can use. If you have any insight on that one, I'd be much obliged.