minerjoe

RelateFeature not creating relationship in offline data

Discussion created by minerjoe Champion on Sep 24, 2020
Latest reply on Sep 26, 2020 by minerjoe

I am trying to creating a relationship in data that is created from taking a map offline and it does not seem to have any effect.  The code takes a list of vertices for a line and creates features that should then relate back to the line

 

foreach (var vertexInfo in Vertices)
{
     var vertexFeature = (ArcGISFeature) vertexTable.CreateFeature();
     vertexFeature.Geometry = vertexInfo.MapPoint;

     if ( vertexInfo.NmeaLocation != null )
     {
          UpdateGpsAttributes(vertexFeature, vertexInfo.NmeaLocation);
     }

     await vertexTable.AddFeatureAsync(vertexFeature);

     Log.Debug($"Relate Feature Origin: {feature.FeatureTable.TableName}:{feature.GetAttributeValue("OBJECTID")}");

     feature.RelateFeature(vertexFeature);

     Log.Debug($"Relate Feature Destination: {vertexFeature.FeatureTable.TableName}:{vertexFeature.GetAttributeValue("OBJECTID")}");
}

 

Everything runs without error and the features are created, however, the RelateFeatures does not do anything.  If I look at the services the relationships are defined:

 

In Vertex Feature Service:

  "relationships" : [
    {
      "id" : 0,
      "name" : "PipelineLine",
      "relatedTableId" : 3,
      "cardinality" : "esriRelCardinalityOneToMany",
      "role" : "esriRelRoleDestination",
      "keyField" : "PipeLineGlobalID",
      "composite" : true
    }
  ],

 

In PipeLine Feature Service:

  "relationships" : [
    {
      "id" : 0,
      "name" : "Vertices",
      "relatedTableId" : 17,
      "cardinality" : "esriRelCardinalityOneToMany",
      "role" : "esriRelRoleOrigin",
      "keyField" : "GlobalID",
      "composite" : true
    }
  ],

 

This is a look Vertex at the table in the offline database, as you can see the PipeLineGlobalID relationship field is left null:

 

 

The log shows that the code to do the relate is running

 

 

The relationships are created in ArcGIS Pro prior to publishing the services to AGOL.

 

Any reason why this relationship does not get created?

 

Thanks

-Joe

Outcomes