|
POST
|
Wondering if anyone can help with the syntax to query a date range? query.where = "County_Nam = '" + (dom.byId("CountyName").value) + "' AND Squad = '" + (dom.byId("Squad").value) + "' "; query.where = "County_Nam = '" + (dom.byId("CountyName").value) + "' AND Squad = '" + (dom.byId("Squad").value) + "' AND DateIncident = '" + (dom.byId("StartDate").value) + "' BETWEEN DateIncident = '" + (dom.byId("EndDate").value) + "' ";
... View more
04-03-2017
12:04 PM
|
0
|
9
|
5044
|
|
POST
|
The query task example shows graphics layer being created...not sure how to create a feature layer and do as you stated.
... View more
03-31-2017
01:28 PM
|
0
|
1
|
1476
|
|
POST
|
I have a query Task that is running and creating a NEW graphics layer and displaying that in the map along with all the records from the query being displayed in a grid. I now want to select the Feature in the map based on an ID select in the table. My example is a bit different than the ESRI example in that I don't have a Feature Layer Defined. I am querying the data and creating a Graphics Layer. I am trying the below and cant seem to get it working... Thoughts? queryTask.on("complete", function(event) {
var highlightSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
new Color([255, 0, 0]), 3), new Color([125, 125, 125, 0.35]));
var symbol = new SimpleMarkerSymbol({
// SNIP Remove code for this example
});
var features = event.featureSet.features;
var countiesGraphicsLayer = new GraphicsLayer();
var featureCount = features.length;
map.graphics.clear();
for (var i = 0; i < featureCount; i++) {
var graphic = features[i]; //Feature is a graphic
graphic.setSymbol(symbol);
graphic.setInfoTemplate(infoTemplate);
map.graphics.add(graphic);
}
});
// fires when a row in the dgrid is clicked
function selectState(e) {
var fl = map.getLayer("countiesGraphicsLayer");
fl.setSelectionSymbol(new SimpleFillSymbol().setOutline(null).setColor("#AEC7E3"));
var query = new Query();
query.objectIds = [parseInt(e.target.innerHTML, 10)];
fl.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(result) {
if ( result.length ) {
// re-center the map to the selected feature
window.map.centerAt(result[0].geometry.getExtent().getCenter());
} else {
console.log("Feature Layer query returned no features... ", result);
}
});
}
... View more
03-31-2017
12:29 PM
|
0
|
4
|
1972
|
|
POST
|
I call this Function on ID click // create the dgrid
window.grid = new(declare([Grid, Selection]))({
// use Infinity so that all data is available in the grid
bufferRows: Infinity,
columns: {
"id": "ID",
"County_Nam": "County_Nam",
"UCR_Code": "UCR_Code",
"Case_Numbe": "Case_Numbe",
"Statute": "Statute",
"Statute_De": "Statute_De",
"Date_Arres": "Date_Arres"
}
}, "grid");
// add a click listener on the ID column
window.grid.on(".field-id:click", selectState); // fires when a row in the dgrid is clicked
function selectState(e) {
alert("record Selected");
// select the feature
var fl = map.getLayer("countiesGraphicsLayer");
var query = new Query();
query.objectIds = [parseInt(e.target.innerHTML, 10)];
fl.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(result) {
if ( result.length ) {
// re-center the map to the selected feature
window.map.centerAt(result[0].geometry.getExtent().getCenter());
} else {
console.log("Feature Layer query returned no features... ", result);
}
});
} Although I am not defining a Feature Layer like in the example....I am creating a new Graphics Layer when I draw the results.. queryTask.on("complete", function(event) {
var highlightSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
new Color([255, 0, 0]), 3), new Color([125, 125, 125, 0.35]));
var symbol = new SimpleMarkerSymbol({
"color": [255, 255, 255, 64],
"size": 12,
"angle": -30,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [0, 0, 0, 255],
"width": 1,
"type": "esriSLS",
"style": "esriSLSSolid"
}
});
var features = event.featureSet.features;
var countiesGraphicsLayer = new GraphicsLayer();
var featureCount = features.length;
map.graphics.clear();
for (var i = 0; i < featureCount; i++) {
var graphic = features[i]; //Feature is a graphic
graphic.setSymbol(symbol);
graphic.setInfoTemplate(infoTemplate);
map.graphics.add(graphic);
}
});
... View more
03-30-2017
06:34 PM
|
0
|
0
|
390
|
|
POST
|
SON OF A B%^$#....lmao...man I cant thank you enough.... I know this is stringing and asking more than I should but do you have any idea how to link the map and table? If I click a record it highlights the feature in the map and visa versa
... View more
03-30-2017
05:59 PM
|
0
|
2
|
2445
|
|
POST
|
I have those added....is there something else I need to do? It appears that only the records that appear in the original defined space of the grid are view-able....as I scroll everything else is black with no text. But if I hover I can see data. Yea I hit the Dev conference in DC as my company wont pay for the Palm Springs visit...
... View more
03-30-2017
05:17 PM
|
0
|
4
|
2445
|
|
POST
|
Freaking awesome man....I cannot thank you enough...on to the next task...never ending... If you are going to the San Diego Conference this year let me buy you a couple cold ones. Last Question: When I get a return and start scrolling through the grid all the rows are Black...if I click on it it appears...is this from not loading all the rows in the entire array? Any ideas or thoughts?
... View more
03-30-2017
04:51 PM
|
0
|
6
|
2445
|
|
POST
|
Give this a look see if you will ...click the "Get Details County Squad " button Edit fiddle - JSFiddle
... View more
03-30-2017
12:14 PM
|
0
|
8
|
2445
|
|
POST
|
Nothing....you can see on the left in the little div there are results being displayed and in the grid at bottom nothing. NO errors int he console. Think I might strip this app down and start again? I am clueless at this point...I have not idea why its not showing up..
... View more
03-30-2017
11:39 AM
|
0
|
1
|
2445
|
|
POST
|
I added this and still nothing...I am crying and laughing at the same time...lol THANK YOU SO VERY MUCH FOR YOUR patience and help.... UPDATED TO WHAT I ACTUALLY HAVE // create the dgrid
window.grid = new (declare([Grid, Selection]))({
// use Infinity so that all data is available in the grid
bufferRows: Infinity,
columns: {
"id": "ID",
"County_Nam": "County_Nam",
"Case_Numbe": "Case Number",
"Date_Arres": "Arrest",
"Violation_": "Violation",
"Officer_Na": "Officers"
}
}, "grid");
// snip
query.outFields = ["OBJECTID","County_Nam","Case_Numbe","Date_Arres","Violation_","Officer_Na"];
// snip
function showResultsCountySquad (results) {
var resultItems = [];
arrayUtils.map(results.features, function(feature) {
var featureAttributes = feature.attributes;
for (var attr in featureAttributes) {
resultItems.push("<b>" + attr + ":</b> " + featureAttributes[attr] + "<br>");
}
resultItems.push("<br>");
});
dom.byId("inforesultsCountySquad").innerHTML = resultItems.join("");
var data = arrayUtils.map(results.features, function(feature) {
return {
// property names used here match those used when creating the dgrid
"id": feature.attributes.OBJECTID,
"County_Nam": feature.attributes.County_Nam,
"Case_Numbe": feature.attributes.Case_Numbe,
"Date_Arres": feature.attributes.Date_Arres,
"Violation_": feature.attributes.Violation_,
"Officer_Na": feature.attributes.Officer_Na
};
});
var memStore = new Memory({ data: data });
window.grid.set("store", memStore);
}
... View more
03-30-2017
11:12 AM
|
0
|
3
|
1981
|
|
POST
|
I can add an ALERT right above memStore and it shows me the correct number of objects in the array. So I know I have data. For some reason I cannot get it to display in the grid...hmmmmm
... View more
03-30-2017
10:50 AM
|
0
|
0
|
1981
|
|
POST
|
Had to remove a couple at the end as well....this is what I have...I get NO Errors in the Console....the DIV populates fine but NOTHING in the grid....I am perplexed...but know I am soooo close I cant thank you enough.... HTML GRID
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'bottom'" style="height:300px; padding:10px; color:black;">
<div id="grid" style="height:300px; color:red;" ></div>
</div>
JAVASCRIPT
// create the dgrid
window.grid = new (declare([Grid, Selection]))({
// use Infinity so that all data is available in the grid
bufferRows: Infinity,
columns: {
"County_Nam": "County_Nam",
"Case_Numbe": "Case Number",
"Date_Arres": "Arrest",
"Violation_": "Violation",
"Officer_Na": "Officers"
}
}, "grid");
// QUERY FOR County and Squad
var queryTask = new QueryTask("https://xxx/arcgis/rest/services/Projects/xxx/FeatureServer/5");
var query = new Query();
query.outSpatialReference = {wkid:4326}; //4326 //102100 //3857
query.returnGeometry = true;
query.outFields = ["County_Nam","Case_Numbe","Date_Arres","Violation_","Officer_Na"];
on(dom.byId("executeCountySquad"), "click", executeCountySquad);
function executeCountySquad () {
query.where = "County_Nam = '"+ (dom.byId("CountyName").value) +"' AND Squad = '"+ (dom.byId("Squad").value) +"' ";
queryTask.execute(query, showResultsCountySquad);
}
function showResultsCountySquad (results) {
var resultItems = [];
arrayUtils.map(results.features, function(feature) {
var featureAttributes = feature.attributes;
for (var attr in featureAttributes) {
resultItems.push("<b>" + attr + ":</b> " + featureAttributes[attr] + "<br>");
}
resultItems.push("<br>");
});
dom.byId("inforesultsCountySquad").innerHTML = resultItems.join("");
var data = arrayUtils.map(results.features, function(feature) {
return {
// property names used here match those used when creating the dgrid
"County_Nam": feature.attributes.County_Nam,
"Case_Numbe": feature.attributes.Case_Numbe,
"Date_Arres": feature.attributes.Date_Arres,
"Violation_": feature.attributes.Violation_,
"Officer_Na": feature.attributes.Officer_Na
};
});
var memStore = new Memory({ data: data });
window.grid.set("store", memStore);
}
... View more
03-30-2017
10:33 AM
|
0
|
6
|
1981
|
|
POST
|
Missing ) somewhere trying to find it.... You help is very much appreciated...I know I am very close
... View more
03-30-2017
10:19 AM
|
0
|
8
|
1981
|
|
POST
|
If I comment out the RETURn I get the values in my DIV....leave it in there and I get nothing...but nothing either time in the GRID
... View more
03-30-2017
09:44 AM
|
0
|
10
|
1981
|
|
POST
|
init.js:113 TypeError: Cannot read property '0' of undefined at index.js:285 at Object.map (init.js:71) at showResultsCountySquad (index.js:277) at Object._successHandler (init.js:2030) at Object._handler (init.js:2026) at init.js:63 at Object.load (init.js:2022) at init.js:996 at c (init.js:103) at d (init.js:103) "TypeError: Cannot read property '0' of undefined at http://127.0.0.1/SummonsParameters/js/index.js:285:61 at Object.map (https://js.arcgis.com/3.20/init.js:71:177) at showResultsCountySquad (http://127.0.0.1/SummonsParameters/js/index.js:277:29) at Object._successHandler (https://js.arcgis.com/3.20/init.js:2030:478) at Object._handler (https://js.arcgis.com/3.20/init.js:2026:254) at https://js.arcgis.com/3.20/init.js:63:277 at Object.load (https://js.arcgis.com/3.20/init.js:2022:253) at https://js.arcgis.com/3.20/init.js:996:139 at c (https://js.arcgis.com/3.20/init.js:103:393) at d (https://js.arcgis.com/3.20/init.js:103:182)"
... View more
03-30-2017
09:42 AM
|
0
|
11
|
1981
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|