Web AppBuilder attributes

2969
4
04-15-2016 11:21 AM
JoseSanchez
Occasional Contributor III

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:

  • Date Created, Date when record was created
  • CreatedBy, Editors User ID
  • DateModified, Date when record was modified for the last time
  • ModifiedBy, Editors User ID
  • PrimaryKeyID, populated with a sequential number, obtained from a sequencer in Oracle
  • Other fields  like municipality or commission district that are populated with the value of the Municipality or Commission district where this polygon intersects

For desktop applications I solved this issue creating an ArcMap Add-In. 

In the old Web ADF I solved this issue using the event:

  • Protected Sub EditorTask1_PostToolExecute(ByVal sender As Object, ByVal editorToolEventArgs As EditorToolEventArgs)  Handles EditorTask1.PostToolExecute

I would like to know how to do that with Web AppBuilder 

4 Replies
RobertScheitlin__GISP
MVP Emeritus

Jose,

  See this thread for the answer:

https://community.esri.com/thread/170004#comment-576213

JoseSanchez
Occasional Contributor III

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

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

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

0 Kudos
AndresCastillo
MVP Regular Contributor

I know this post has been here a while, but I am going to try the smart editor widget.

0 Kudos