AnsweredAssumed Answered

QueryTask on REST Endpoint that ends in /queryRelatedRecords

Question asked by KeitherJ on Jun 23, 2015
Latest reply on Jun 23, 2015 by KeitherJ

Folks

 

Is this expected to work?

I cannot get it to go.

I am guessing I have to create a new RelationQuery through code.

Let me know.

 

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <!--The viewport meta tag is used to improve the presentation and behavior of the samples
      on iOS devices-->
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
    <title>Query State Info without Map</title>


    <script src="http://js.arcgis.com/3.13/"></script>
    <script>
        require([
          "dojo/dom", "dojo/on",
          "esri/tasks/query", "esri/tasks/QueryTask", "dojo/domReady!"
        ], function (dom, on, Query, QueryTask ) {


            var queryTask = new QueryTask("http://localhost:6080/arcgis/rest/services/Ggov/MI_Default/MapServer/7/queryRelatedRecords");


            var query = new Query();
            query.returnGeometry = false;
            query.outFields = ["*"];
            query.relationshipId = 0;
            query.objectIds = [2, 3];


            queryTask.execute(query, showResults);




            function showResults(results) {
                var resultItems = [];
                var resultCount = results.features.length;
                for (var i = 0; i < resultCount; i++) {
                    var featureAttributes = results.features[i].attributes;
                    for (var attr in featureAttributes) {
                        resultItems.push("<b>" + attr + ":</b>  " + featureAttributes[attr] + "<br>");
                    }
                    resultItems.push("<br>");
                }
                dom.byId("info").innerHTML = resultItems.join("");
            }
        });
    </script>
</head>


<body>
    <div id="info" style="padding:5px; margin:5px; background-color:#eee;">
    </div>
</body>
</html>

Thanks

 

Keith Anderson

Outcomes