//QueryFS.js //Order variables in same order as in pulldata() function function runFSQuery(ProNum,ProName,Location,Fields,Token,DebugMode){ //Declare variables var number = ProNum var name = ProName var location = Location var token = Token if(location===""){ return(DebugMode? "Select a site location":""); } var featureLayer = "FEATURE URL/ITEM" var xmlhttp = new XMLHttpRequest(); //Set up query parameters var query = "ProjectNumber='" + number + "' AND ProjectName='"+ name + "' AND LocationName='" + location + "'" //Encodes query string for URL query var query = encodeURIComponent(query) var url = featureLayer + "/query?where=" + query +"&objectIds=&time=&geometry=&geometryType=esriGeometryPoint&inSR=&spatialRel=esriSpatialRelIntersects&resultType=none&distance=0.0&units=esriSRUnit_Foot&returnGeodetic=false&outFields=" + Fields + "&returnHiddenFields=false&returnGeometry=true&multipatchOption=xyFootprint&maxAllowableOffset=&geometryPrecision=&outSR=4326&datumTransformation=&applyVCSProjection=false&returnIdsOnly=false&returnUniqueIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&returnDistinctValues=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&having=&resultOffset=&resultRecordCount=&returnZ=false&returnM=false&returnExceededLimitFeatures=true&quantizationParameters=&sqlFormat=none&f=json" //Generates token if layer is not public if (token){ url = url + "&token=" + token; } xmlhttp.open("GET",url,false); xmlhttp.send(); if(xmlhttp.status!==200){ return(DebugMode? xmlhttp.status:""); }else{ var responseJSON=JSON.parse(xmlhttp.responseText) if(responseJSON.error){ return(DebugMode? JSON.stringify(responseJSON.error):""); }else{ //[ITEM] if(responseJSON.features[0]){ return JSON.stringify(responseJSON.features[0]); } else{ return(DebugMode? "No Features Found":""); } } } }