I could do that, but for that matter I could not have the not-null constraints on the fields in the first place since I run the database too.It seems to rather defeat the point of using the database as it should be, to ensure that checks are applied to the data at the point of creation so they are guaranteed to be "valid". Thus preventing some other client from (maliciously or otherwise) sticking loads of random and incomplete stuff in. Surely that is just common sense database design? If on the other hand the attribute inspector could produce a Graphic (perhaps having automatically generated the attribute schema for that graphic from the feature layer) then the client could more easily generate a valid feature before submission. As it is, it seems that the workflow (if we want to use the pre-made editing widgets) is to generate and store in the database an invalid feature, having crippled the database to make this possible, then update the feature in an entirely separate operation after it's created to make it valid. Whilst hoping that nobody comes along and generates invalid features by some other means, or that our client doesn't suffer some kind of error in between making the feature and modifying it.Just seems rather back to front to me - is this really the intention?
As the title says, I have a feature layer, which is based on a feature class where several fields are constrained to be NOT NULL. I'm hoping to use this to provide the back-end to a volunteered geographic information type map. Likewise I am hoping to use the template picker and attribute inspector to create the features.The default workflow in the samples is for the feature to be created using applyEdits with the clicked geometry and null attributes when the map click or draw end event fires, then to display the attribute inspector on this feature to update them. But as far as I can tell I can't take this approach as I can't create the feature with null attributes due to the feature class constraints. The workflow that seems to be sensible is for a map onclick event to create a new feature as a graphic, and then display the attribute inspector on it in an infowindow, with a submit button. When the fields are populated (and validated), pressing the submit button will be what calls applyEdits on the feature layer, which can now be done as all attributes are present. This is pretty much what seems to be done by the Citizen Request Sample template app which "rolls its own" content for the info window to populate the fields. But i'd rather use the template picker and the attribute inspector to do the attribute editing, particularly because of the ease of styling, working with coded value domains etc, and so that the app isn't totally tied to the schema of the feature class like it is with that template. But the attribute inspector seems to be inherently tied to feature layers rather than graphics.What am i missing? Any suggestions as to a better way to accomplish this? The main point is that I don't want to get features submitted that don't have all the attributes I need, hence the use of the constraints when I set up the feature class.Thanks! Harry
var Attributes = { field1: "", field2: "", ..... }; var newFeature = new esri.Graphic(geometry, null, Attributes); // then apply attributerSepctor, so when you apply featureLayer.applyEdits (newFeature, null, null)...
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.