Query Related Records

6121
9
08-05-2010 09:40 AM
MeleKoneya
Occasional Contributor III
I have set up a relate in a map service and would like to access that relate via REST.

When I click on the 'Query Related Records' link in the map service and I am asked for the Object Ids, and the Relationship Id as shown in the attached image.

Where do I find the Relationship Id and Object Id?
0 Kudos
9 Replies
RaviNarayanan
Esri Contributor
The relationships are listed in the layer/table description, for example this table has one relationship :

http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/MapServer/1

Relationships:
IncidentPriority_ServiceRequest (1)  -- Related To: Incidents (0)

In this case 1 is the relationshipID and 0 represents the id of the related table/layer.

The objectIDs will be the objectIDs for which you want to find the related records from the related table/layer

You can get some more info about Query related records operations here:
http://sampleserver3.arcgisonline.com/ArcGIS/SDK/REST/queryrelatedrecords.html
0 Kudos
MeleKoneya
Occasional Contributor III
Thanks for the response and the information.     I am still not able to get our relate to work.    Does the related table need to be a stand alone table or can you relate two feature classes in your MXD?    I noticed your example shows a feautre class related to a stand alone table.

Thanks,

Mele
0 Kudos
MeleKoneya
Occasional Contributor III
I used the new Query Layer in ArcGIS 10 to create a 'table' from a feature class and then performed the relate on the newly created Query Layer and now can Query Related records in the ArcGIS Map Service.

Is it a good practice to create a Query Layer agains the Feature Class or should I use a Multi-Version view or another method?
0 Kudos
RaviNarayanan
Esri Contributor
You can relate two feature classes. There is a currently a bug where Query Related records returns an error in .NET REST when there are no standalone tables in the published map document.

NIM058773: Query related records fails with error "Invalid value for parameter 'outFields'".

Workaround is to have an empty table in the map and this table does not need to participate in the relationship.  We are fixing this bug in 10.0 SP1.
0 Kudos
MeleKoneya
Occasional Contributor III
Thanks for updating this.    I had contacted support and I will forward the BUG number you gave to me.
0 Kudos
WillHughes1
Occasional Contributor II
Is Query Related Records and relates supported in ArcGIS Server 9.3.1 map services?

I have a relate (fc to standalone table) set up in my .mxd. I created the .msd in ArcMap 9.3.1.
The .msd was published to a map service by someone else.

The layer with the relate doesn't even draw in the map, and there is no information on the relate in the map service page - http://10.130.1.211/ArcGIS/rest/services/Testing/Hydrant/MapServer/1
and the only supported operation is Query.
Is this only supported in ArcGIS Server 10?

I am also using the Flex API 2.0.

Thanks.

Will
0 Kudos
MeleKoneya
Occasional Contributor III
Will,

Map services which show relates within the MXD is new in ArcGIS 10.0

http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/0093/00930000000m000000.h...

Mele
0 Kudos
WillHughes1
Occasional Contributor II
Mele,

Thanks. I assumed that was the case.
How about joins? supported in 10 only?

Will
0 Kudos
WillHughes1
Occasional Contributor II
Does anyone have a workaround for this for those of us who will be on 9.3 for a while?

My only thoughts are to build an ASP or Cold Fusion page to display the data, and hopefully figure out how to pass a query string in the flexviewer (2.1).
Is this possible in the flexviewer?

It would be great if someone has a working example of this.

Thanks.

Will
0 Kudos