AnsweredAssumed Answered

Adding attributes to a related table issues.

Question asked by kschultz@bgohio.org on Aug 1, 2018

I've been trying to add a new record into a related table. Which I've been able to figure out(sort of) but I've run into other issues.

 

My first issue is when I try to add a new record to the related table the attributes do not come through. They appear as null when passing them through.  The related features globalID is present in the table and last edited user but the custom attributes I'm passing through fails.

 

My second issue is and it maybe related to my first issue but the related table records that are being added are not appearing in my sde until I compress the sde.  

 

I've tested this out using collector and can add a record to a related table(and works exactly how I would expect it to). So I know it isn't how I setup the relationship to the tables

 

Here is the code I've got going so far that writes data back to the feature service:

           FeatureLayer {
               id: featureLayer1
               ServiceFeatureTable {
                   id: relateTable
                   url: "/FeatureServer/1"
                   onApplyEditsStatusChanged: {
                       console.log(applyEditsStatus)
                       console.log(Enums.TaskStatusCompleted)
                                 if (applyEditsStatus === Enums.TaskStatusCompleted) {
                                     console.log("successfully added feature");
                                 }
                             }
                   onAddFeatureStatusChanged: {
                              if (addFeatureStatus === Enums.TaskStatusCompleted) {
                                  // apply the edits to the service
                                  relateTable.applyEdits();
                              }
                   }
               }
           }


onQueryFeaturesStatusChanged: {

if (queryFeaturesStatus === Enums.TaskStatusCompleted) {
if (!queryFeaturesResult.iterator.hasNext) {
return;
}

featureLayer.clearSelection();

var features = []

while (queryFeaturesResult.iterator.hasNext) {
features.push(queryFeaturesResult.iterator.next());
}

featureLayer.selectFeatures(features);


mapView.setViewpointCenterAndScale(features[0].geometry,200);
var tolerance = 22;
var returnPopupsOnly = false;
var maximumResults = 1;

var featureAttributes = {"ID_TAG" : "0000-TEST"};


var featureNew = relateTable.createFeature(featureAttributes);

features[0].relateFeature(featureNew)

relateTable.addFeature(featureNew);


// mapView.identifyLayerWithMaxResults(features[0].geometry);


}
}

Outcomes