|
POST
|
Diana - success! 😉
function deleteRecords() {
//build query filter
var query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = ["*"];
query.outSpatialReference = { "wkid": 27700 };
query.where = "PROCESS = 'Report Dead Animal'";
// Query for the features with the given object ID
pointsOfInterestD.queryFeatures(query, function (featureSet) {
var graphics = featureSet.features;
pointsOfInterestD.applyEdits(null, null, graphics, function (deletes) {
console.debug(deletes.length)
},
function errCallback(err) {
alert(err);
})
});
} Deletes those features I need - as you suggested the feature layer is define and added outside this function (in the init function) I now need to plumb in the exact delete requirements (as all the dead animals are gone!) - sorry, but as I'm not the OP I can't mark as answered, but I am sure this will meet the OP's requirements as well. Many thanks for your help. ACM PS - FYI after getting working I removed the map.adlayers for my featurelayer and it still works.
... View more
01-29-2013
06:22 AM
|
0
|
0
|
3881
|
|
POST
|
Ah - that looks sound - I see now not needing the querytask is a good thing - I'll try tomorrow. Many thanks ACM
... View more
01-28-2013
11:14 AM
|
0
|
0
|
3881
|
|
POST
|
Seems fine to me using the only Win 7 IE10 [ATTACH=CONFIG]21137[/ATTACH] Are there any console error messages?
... View more
01-28-2013
09:43 AM
|
0
|
0
|
1673
|
|
POST
|
Nope - my code now looks like function deleteRecords() { var queryTask = new esri.tasks.QueryTask("http://xxx/gis2/arcgis/rest/services/LIVEinternal/DeleteLaganCase/FeatureServer/0");
//build query filter
var query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = ["*"];
query.outSpatialReference = { "wkid": 27700 };
query.where = "PROCESS = 'Report Dead Animal'";
queryTask.execute(query, doDelete);
}
function doDelete(featureset) {
var pointsOfInterestD = new esri.layers.FeatureLayer("http://xxx/arcgis/rest/services/LIVEinternal/DeleteLaganCase/FeatureServer/0", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"]
});
map.addLayers([pointsOfInterestD]);
var graphics = featureset.features;
console.debug(graphics)
pointsOfInterestD.applyEdits(null, null, graphics, function onComplete(adds, updates, deletes) {
console.debug(deletes.length)
if (deletes.length > 0) {
alert("deletes : " + JSON.stringify(deletes));
}
},
function errCallback(err) {
alert(err);
});
} Still the console.debug(graphics) returns several objects (with geometry and attributes), but the console.debug(deletes.length) returns 0 very strange
... View more
01-28-2013
08:36 AM
|
0
|
0
|
3881
|
|
POST
|
Cheers - the feature layer I delete from I have set up just for this purpose - the layer the users add records has all the records filtered out (for now), as I don't want a complex edit template - once I have worked out how to delete records without using the editor widget I'll move on to adding them. (and I have tried adding this one to the map as well as per you earlier post 🙂 ) I'm at home now,so can't play with the geometry thing - any good samples you can point to - no problem if not, I'll have a good look later. Cheers ACM edit Doh! I see what you mean the false in the return geometry - maybe a quick look now.
... View more
01-28-2013
08:22 AM
|
0
|
0
|
3881
|
|
POST
|
Diana - thanks for the advice to the OP - My code is similar now after your last answer -
function deleteRecords()
{
var queryTask = new esri.tasks.QueryTask("http://xxx/arcgis/rest/services/LIVEinternal/DeleteLaganCase/FeatureServer/0");
//build query filter
var query = new esri.tasks.Query();
query.returnGeometry = false;
query.outFields = ["*"];
query.outSpatialReference = { "wkid": 27700 };
query.where = "PROCESS = 'Report Dead Animal'";
queryTask.execute(query,doDelete);
}
function doDelete(featureset) {
var pointsOfInterestD = new esri.layers.FeatureLayer("http://xxx/arcgis/rest/services/LIVEinternal/DeleteLaganCase/FeatureServer/0", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"]
});
var graphics = featureset.features;
console.debug(graphics)
pointsOfInterestD.applyEdits(null, null, graphics, function onComplete(adds, updates, deletes) {
console.debug(deletes.length)
if (deletes.length > 0) {
alert("deletes : " + JSON.stringify(deletes));
}
},
function errCallback(err) {
alert(err);
});
}
I've added the OP's oncomplete part - number of deletes = 0, no errors. However, using the same code, but making it an insert works fine. I'm guessing it is something to do with the OBJECTID, but can't see what - here's the result from the console when I ask it toreturn the graphic object [Object, Object]
0: Object
attributes: Object
CASEID: 101000243048
OBJECTID: 13608
PROCESS: "Report Dead Animal"
__proto__: Object
geometry: Object
infoTemplate: undefined
symbol: undefined
__proto__: Object
1: Object
length: 2
__proto__: Array[0]
Any ideas? Cheers ACM PS using http://xxx/arcgis/rest/services/LIVEinternal/DeleteLaganCase/FeatureServer/0/deleteFeatures Interface, I can delete the records with the OBJECTID returned - but it fails in the code - so I would say it is a valid OBJECTID and the service allows deletes.
... View more
01-28-2013
02:12 AM
|
0
|
0
|
3881
|
|
POST
|
I'm trying to do something similar - add a button that deletes all features that meet a entered requirement - not having much luck - I think it is something in the query- not got as far as actually sending the deletes but this is what I have function deleteRecords(){
var queryTask = new esri.tasks.QueryTask("http://<server stuff>/FeatureServer/0");
//build query filter
var query = new esri.tasks.Query();
query.returnGeometry = false;
query.outFields = ["PROCESS"];
query.outSpatialReference = { "wkid": 27700 };
query.where = "PROCESS = 'Report Dead Animal'";
queryTask.execute(query,doDelete);
}
function doDelete(featureset) {
console.debug(featureset.features)
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,255,255,0.35]), 1),new dojo.Color([125,125,125,0.35]));
//QueryTask returns a featureSet. Loop through features in the featureSet and add them to the map.
dojo.forEach(featureSet.features,function(feature){
alert("yay")
var graphic = feature;
graphic.setSymbol(symbol);
graphic.setInfoTemplate(infoTemplate);
map.graphics.add(graphic);
});
} The "console.debug(featureset.features)" shows 5 objects, which is correct, but then I get no alert("yay") - which I should. Ideas? ACM
... View more
01-25-2013
06:20 AM
|
0
|
0
|
3881
|
|
POST
|
So, is refresh() an undocumented method of ArcGISDynamicMapServiceLayer? it certainly seems to do what it says?
... View more
01-17-2013
04:03 AM
|
0
|
0
|
1858
|
|
POST
|
Hi I've a site that I have finally got working to create features. These features need to have attribute values that have been passed to the page in a URL - it is the case number and type from our internal CRM system. I can't see an obvious way to get these assigned to new features. Any ideas? Cheers ACM Edit - easy peasy - onBeforeApplyEdit event of the featurelayer - see http://forums.arcgis.com/threads/45726-Editor-attribute-inspector-default-values?highlight=default+attribute Kelly if you want to post a reply to me to tell me to look at the above post then I can mark it as answered.
... View more
01-16-2013
02:41 AM
|
0
|
0
|
892
|
|
POST
|
Sorted - http://support.microsoft.com/kb/317955 - I needed to give (in my case the local IISUSER account, the rights specified here to my entire web folder. Odd that Chrome was ok and IE not. ACM
... View more
01-16-2013
12:42 AM
|
0
|
0
|
489
|
|
POST
|
Yes-or I thought I did - it is in IIS7 so a bit different. I tried to move my Chrom working/IE not working to my internet site - where of course it works!! I can't see any obvious difference in the setup of either the proxy.config or the IIS Application Anyway - supper time for me. Cheers ACM
... View more
01-15-2013
10:45 AM
|
0
|
0
|
489
|
|
POST
|
Thanks for that - we posted at the same time - however, my proxy.config now looks like this and IE still fails
<?xml version="1.0" encoding="utf-8" ?>
<!-- Proxy config is used to set the ArcGIS Server services that the proxy will forward to.
mustMatch: true to only proxy to sites listed, false to proxy to any site -->
<ProxyConfig mustMatch="false">
<serverUrls>
<!-- serverUrl options:
url = location of the ArcGIS Server, either specific URL or stem
matchAll = true to forward any request beginning with the url
token = (optional) token to include for secured service
dynamicToken = if true, gets token dynamically with username and
password stored in web.config file's appSettings section.
-->
<serverUrl url="http://eddc-gis2"
matchAll="true"
></serverUrl>
</serverUrls>
</ProxyConfig>
I'll see if I get get a page on the internet later. IE just does nothing. Cheers ACM
... View more
01-15-2013
08:05 AM
|
0
|
0
|
2328
|
|
POST
|
Sorry - misread your post - see the setting you mean now. I'll try that.
... View more
01-15-2013
07:58 AM
|
0
|
0
|
2328
|
|
POST
|
Si instead of <serverUrl url="http://hummer/ArcGIS/rest/services" matchAll="true"
dynamicToken="true"
></serverUrl> Would you simply have <serverUrl matchAll="flase"
dynamicToken="true"
></serverUrl> ? The comments in the proxy.config isn't very clear. To me " matchAll = true to forward any request beginning with the url" Means that if I set the URL to "http://myserver/" and matchAll = True the any request beginning "http://myserver/" will work. Cheers ACM
... View more
01-15-2013
07:54 AM
|
0
|
0
|
2328
|
|
POST
|
Hi - I've got a similar issue - but it seems to be IE specific. I have the proxy all set and Chrome and Firefox work fine./ Yet IE (8 & 9) fail In Fiddler I see a 500 error reported for POST /proxy/proxy.ashx?http://our server/arcgis/rest/services/test/edit/FeatureServer/0//applyEdits HTTP/1.1 With the page being returned as the normal .NET page Server Error in '/proxy' Application. and saying how to make changes to the web.config (which I don't have) to get better errors. I've just used the default proxy pages from the esri site (I'd edited the previous ones) and still get the error. When run on the server - fiddler shows a 500 page with [TABLE="width: 100%"] [No relevant source lines] [/TABLE] Any ideas. ACM
... View more
01-15-2013
05:27 AM
|
0
|
0
|
2328
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-19-2026 12:29 AM | |
| 1 | 08-28-2025 01:14 AM | |
| 1 | 12-01-2023 06:07 AM | |
| 2 | 11-29-2024 04:32 AM | |
| 1 | 05-28-2024 12:50 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|