I have a relationship between table A (Origin) and Table B (Destination). The relationship is set as follows:
Table A has PrimaryKey OBJECTID and Table B has Foreign Key REL_OBJECTID
I am able to create related data by using ArcGIS Collector app. However when querying the data I noticed REL_OBJECTID is always set to 0 although the relationship clearly exists. As a result I am not able to add new Table B features via ArcGIS REST API (http://<featurelayer-url>/addFeatures) that link to Table A.
[
{
"attributes" : {
"req_id" : "508389",
"req_type" : "Graffiti Complaint - Public Property",
"req_date" : "09\/19\/2009",
"req_time" : "18:44",
"address" : "11TH ST and HARRISON ST",
"x_coord" : "6008925.0",
"y_coord" : "2108713.8",
"district" : "6",
"status" : 1,
"REL_OBJECTID": 1
},
"geometry" : {
"x" : -122.41247978999991,
"y" : 37.770630098000083
}
}
]
What am I doing wrong?
Thanks
Goran
Solved! Go to Solution.
I figured it out, I needed to add the GUID of Table A record in the call in order to establish a link
[
{
"attributes" : {
"req_id" : "508389",
"req_type" : "Graffiti Complaint - Public Property",
"req_date" : "09\/19\/2009",
"req_time" : "18:44",
"address" : "11TH ST and HARRISON ST",
"x_coord" : "6008925.0",
"y_coord" : "2108713.8",
"district" : "6",
"status" : 1,
"Guid" : "e2e571db-74a0-4acd-829e-bfe945422f16"
"REL_OBJECTID": 1
},
"geometry" : {
"x" : -122.41247978999991,
"y" : 37.770630098000083
}
}
]
What type of relationship did you set up? Just ensure that it is not a many:many relationship, that could be causing the issue.
Blog post explains the relationships that will function with Collector:
-----------------------------------
Brian Baldwin, Esri Inc., Lead Solution EngineerHi Brian,
i have set up a 1:M relationship between Table A and Table B. I noticed if I designate my own Primary Key in Table A and use it as Foreign key in Table B then Collector passes the Primary Key from table A to Foreign Key in Table B correctly.
If, on the other hand, I use OBJECTID as PK in Table A then the related REL_OBJECTID in Table B is always set to 0. What is puzzling is that the relationship between the two records definitely exists. I just don't understand how is this possible given 0 value in REL_OBJECTID
Thanks
Goran
I figured it out, I needed to add the GUID of Table A record in the call in order to establish a link
[
{
"attributes" : {
"req_id" : "508389",
"req_type" : "Graffiti Complaint - Public Property",
"req_date" : "09\/19\/2009",
"req_time" : "18:44",
"address" : "11TH ST and HARRISON ST",
"x_coord" : "6008925.0",
"y_coord" : "2108713.8",
"district" : "6",
"status" : 1,
"Guid" : "e2e571db-74a0-4acd-829e-bfe945422f16"
"REL_OBJECTID": 1
},
"geometry" : {
"x" : -122.41247978999991,
"y" : 37.770630098000083
}
}
]