Hello everyone,
This question is about how to add logic in ArcGIS Online to fields that are populated by application, not by data entry.
I was able to create in ArcGIS Online a Web Mapping Application that has only one layer. The layer is a feature service pointing to SDE in a versioned environment. The layer is a polygon.
The ArcGIS Online web mapping application works fine. It allows to digitize a new feature polygon and populate its attributes.
My question is about how pre-populate some attributes with default values such as:
For desktop applications I solved this issue creating an ArcMap Add-In.
In the old Web ADF I solved this issue using the event:
I would like to know how to do that with Web AppBuilder
I took a look to this link.
I do not see any event that will trigger when the editor creates or modifies a new feature.
This is what I would like to implement that works already in an Add-In:
'Invoked when a feature is created or modified
Private Sub Events_OnCreateFeature(ByVal obj As ESRI.ArcGIS.Geodatabase.IObject)
Dim inFeature As IFeature = CType(obj, IFeature)
Dim featureClass As IFeatureClass
Dim intNextMyEditableLayerId As Integer
featureClass = CType(obj.Class, IFeatureClass)
DisplayFieldNamesAndAliasNames(featureClass)
' MsgBox(featureClass.AliasName)
If featureClass.AliasName <> "MyEditableLayer" And featureClass.AliasName <> "APP.MyEditableLayer" Then
Exit Sub
End If
' GetConnectionStrings()
intNextMyEditableLayerId = NextMyEditableLayerNumber()
' Populate the next MyEditableLayerID available
'
Dim fieldIndex As Integer = featureClass.FindField("MyEditableLayerID")
If fieldIndex = -1 Then
Exit Sub
End If
inFeature.Value(fieldIndex) = intNextMyEditableLayerId
Jose,
Your add-in code has little bearing in WAB. The thread I pointed you to allows for autopopulating a field with data before the feature is created on the server. The event that is used is the features before-apply-edits
I know this post has been here a while, but I am going to try the smart editor widget.