Example service used: Best Practices_WFL1
- Query the Feature Service to get details (including layer names and IDs):
- Query layer 0 details (including relationships details)
For example, layer 0:
{
"relationships": [{
"id": 0,
"name": "BP - Sites",
"relatedTableId": 1,
"cardinality": "esriRelCardinalityOneToOne",
"role": "esriRelRoleOrigin",
"keyField": "GPS_Latitude_D",
"composite": false
}]
}
- Query how many records layer 0 has:
- Get all records from layer 0 (but in PBF; for perfomance):
- Query the Feature Service (Layer 0) to find out how many related records using queryRelatedRecords. Each record have:
Note: in this example the record with Unique ID BP155 was clicked, it's properties are:
{
"attributes" : {
"OBJECTID" : 1,
"Unique_ID" : "BP155",
"Created_on" : 1557653940000,
"Created_by" : "Juhan Telgmaa",
"Title_of_the_best_practice" : "Envi educcation",
"Excerpt" : "Better availability of info related to different envi aspects of beach and surroundings.",
"Country" : "Estonia",
"Type_of_site" : "beach",
"Field" : "Environmental Education; Information",
"Blue_Flag_site" : "BF4940 Pirita",
"GPS_Longitude" : "24.828698",
"GPS_Latitude" : "59.469819",
"GPS_Longitude_D" : 24.828698,
"GPS_Latitude_D" : 59.469819,
"Management_Body" : "Pirita district government of City of Tallinn",
"Methodology" : "The pamphlets are made available by QR code for phones. No need to waste paper for printed work, no need to collect and recycling of garbage, more info available, easy to add or uptodate info.",
"Related_Website" : null,
"Title_Image__Hero_" : "Pirita buklett 1.PNG",
"Description_Images__Carrousel_" : "Pirita buklett 2.PNG",
"Contact_for_further_information" : "Pirita district government",
"This_best_practice_participates" : "6 Clean Water and sanitation; 11 Sustainable cities and communities; 12 Responsible consumption and production",
"Tags" : null
}
}
Note the value of the relationship keyfield
GPS_Latitude" : "59.469819"
.
- Start by getting details from layer 1:
- Query again all record from layer 0: (not sure why)
- Query the related record (query agains layer 1 by setting relationship keyfield value)
Note: "where" clause ->
Latitude='59.469819'