Do I have to create the webservice in Visual Studio? If so, I would prefer to use a geodatabase. Do you know of any examples? Thanks
var inspections:FeatureLayer = new FeatureLayer("http://" + Model.instance.serverHost + "/ArcGIS/rest/services/Delivery/T_Inspections/FeatureServer/1"); inspections.addEventListener(FeatureLayerEvent.EDITS_COMPLETE, inspections_editsCompleteHandler); inspections.addEventListener(FeatureLayerEvent.EDITS_STARTING, inspections_editsStartingHandler); inspections.addEventListener(FaultEvent.FAULT, inspections_faultHandler); var arr:Array = new Array(); for each(var item:Object in l_structures.selectedItems){ const inspection:Object = { GISONUMBER: item.GISONUMBER.toString(), INSPECTIONDATE: df_dateInspected.selectedDate.time, PATROLMANID: dd_patrolmanID.selectedItem.PATROLMANID.toString(), PATROLTYPE: dd_patrolType.selectedItem.TYPECODE.toString(), LINENUMBER: dd_lineNumber.selectedItem.ID.toString() }; const g:Graphic = new Graphic(null,null,inspection); arr.push(g); } inspections.applyEdits(arr, null, null, true);
This seems the way to go Casey. Do you more examples or a more complete example that you can share? Thank you so much!
private var inspections:FeatureLayer = new FeatureLayer("http://" + Model.instance.serverHost + "/ArcGIS/rest/services/Delivery/T_Inspections/FeatureServer/1"); protected function init():void{ inspections.addEventListener(FeatureLayerEvent.EDITS_COMPLETE, inspections_editsCompleteHandler); inspections.addEventListener(FeatureLayerEvent.EDITS_STARTING, inspections_editsStartingHandler); inspections.addEventListener(FaultEvent.FAULT, inspections_faultHandler); } /* function used to create inspection records */ protected function btn_createInspection_clickHandler(event:MouseEvent):void{ //Modify this portion to meet your requirements. const inspection:Object = { GISONUMBER: item.GISONUMBER.toString(), INSPECTIONDATE: df_dateInspected.selectedDate.time, PATROLMANID: dd_patrolmanID.selectedItem.PATROLMANID.toString(), PATROLTYPE: dd_patrolType.selectedItem.TYPECODE.toString(), LINENUMBER: dd_lineNumber.selectedItem.ID.toString() }; const g:Graphic = new Graphic(null,null,inspection); inspections.applyEdits(, null, null, true); } /* function used to handle when editing of inspections starts */ protected function inspections_editsStartingHandler(event:FeatureLayerEvent):void{ CursorManager.setBusyCursor(); } /* function used to handle when editing of inspections completes */ protected function inspections_editsCompleteHandler(event:FeatureLayerEvent):void{ try{ var flag:Boolean = true; var result:FeatureEditResult; for each(result in event.featureEditResults.addResults){ if (!result.success) flag = false; } if(flag) Alert.show('Created - ' + event.featureEditResults.addResults.length.toString() + ' inspection records', 'info'); else Alert.show('Some inspection records failed to create, rolling back edits','warning'); CursorManager.removeBusyCursor(); }catch(error:Error){ CursorManager.removeBusyCursor(); } } /* function to handle when editing inspections faults */ protected function inspections_faultHandler(event:FaultEvent):void{ Alert.show(event.fault.faultDetail, 'fault'); CursorManager.removeBusyCursor(); }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.