Select to view content in your preferred language

Create a new Record On a Related Feature Table

459
3
03-11-2019 11:19 AM
MKa
by
Frequent Contributor

I have a related table to my Feature Service called "notes".  I want to simply add a note to this related table that links back to my feature service.  I believe i have set up the proper keys/relationship.  I have also been able to cast this table as both a ServiceFeatureTable or a FeatureTable.  Now i am working on simply trying to create a record that will work both online and offline.  I can work out all the UI stuff, but is there a quick example of how to just make a new record with a new "note" column entry?

ServiceFeatureTable onlineFeatureTable
onlineFeatureTable = map.tables.get(0);



0 Kudos
3 Replies
MKa
by
Frequent Contributor

So now I have this table as  a QmlServiceFeatureTable but cannot seem to create a feature on that related table.  Every time I try to make a feature, the result is null.  i simply want to create a record in this related table, update the attributes, and apply edits.  I cant get the create feature to work get a new feature, let alone get to the point where I can addfeature and applyedits.

ServiceFeatureTable onlineFeatureTable
onlineFeatureTable = map.tables.get(0); //THIS is an empty table that is related to one of my feature layers, confirmed that it exists

//None of these work, the resulting feature is null?
//1
var onlineFeature = onlineFeatureTable.createFeature(); //Null result

//2
var featureAttributes = {"1" : "1", "2" : "2"};
var onlineFeature = onlineFeatureTable.createFeatureWithAttributes(featureAttributes, null); //Null result

//3
var featureAttributes = {"1" : "1", "2" : "2"};
var onlineFeature = onlineFeatureTable.createFeature(featureAttributes); //Null result




0 Kudos
MichaelReese
Emerging Contributor

I have only had success when creating features with a geometry.

Esri::ArcGISRuntime::Feature* feature = table->createFeature(attributes, geometry, parent);

Also, make sure the attributes match the table correctly

0 Kudos
MKa
by
Frequent Contributor

So did you create a related table that has geometry.  I cannot even create a feature on my related table, but my related table has no geometry.

0 Kudos